remove throttler and its dependencies
This commit is contained in:
parent
e1d082e6e6
commit
b111c4d47a
3 changed files with 3 additions and 20 deletions
16
app/Main.hs
16
app/Main.hs
|
@ -37,7 +37,6 @@ import Network.Socket (defaultPort)
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Network.Wai.Logger
|
import Network.Wai.Logger
|
||||||
import Network.Wai.Handler.Warp
|
import Network.Wai.Handler.Warp
|
||||||
import Network.Wai.Middleware.Throttle
|
|
||||||
|
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
|
|
||||||
|
@ -144,20 +143,7 @@ main = do
|
||||||
, rsMailQueue = mailQueue
|
, rsMailQueue = mailQueue
|
||||||
}
|
}
|
||||||
expirationSpec = TimeSpec 5 0 -- five seconds
|
expirationSpec = TimeSpec 5 0 -- five seconds
|
||||||
throt = (defaultThrottleSettings expirationSpec)
|
runSettings settings (app initState)
|
||||||
{ throttleSettingsRate = 10
|
|
||||||
, throttleSettingsPeriod = 1000
|
|
||||||
}
|
|
||||||
th <- initCustomThrottler throt
|
|
||||||
(\req ->
|
|
||||||
let headers = requestHeaders req
|
|
||||||
in case lookup "x-forwarded-for" headers of
|
|
||||||
Just addrs ->
|
|
||||||
let xaddr = fst (B8.break (== ',') addrs)
|
|
||||||
in Right $ Address $ toSockAddr (read (B8.unpack xaddr), defaultPort)
|
|
||||||
Nothing -> Right $ Address $ remoteHost req
|
|
||||||
)
|
|
||||||
runSettings settings (throttle th (app initState))
|
|
||||||
where
|
where
|
||||||
opts = info (options <**> helper)
|
opts = info (options <**> helper)
|
||||||
( fullDesc
|
( fullDesc
|
||||||
|
|
|
@ -14,11 +14,9 @@
|
||||||
haskellPackages = pkgs.haskellPackages.override {
|
haskellPackages = pkgs.haskellPackages.override {
|
||||||
overrides = hself: hsuper: {
|
overrides = hself: hsuper: {
|
||||||
pg-transact = with pkgs.haskell.lib;
|
pg-transact = with pkgs.haskell.lib;
|
||||||
doJailbreak (unmarkBroken (dontCheck doJailbreak(hsuper.pg-transact)));
|
unmarkBroken (dontCheck (doJailbreak hsuper.pg-transact));
|
||||||
hspec-wai-json = with pkgs.haskell.lib;
|
hspec-wai-json = with pkgs.haskell.lib;
|
||||||
doJailbreak (unmarkBroken (dontCheck doJailbreak(hsuper.hspec-wai-json)));
|
unmarkBroken (dontCheck (doJailbreak hsuper.hspec-wai-json));
|
||||||
token-bucket = with pkgs.haskell.lib;
|
|
||||||
doJailbreak (unmarkBroken (dontCheck doJailbreak(hsuper.token-bucket)));
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,6 @@ executable mateamt
|
||||||
, warp
|
, warp
|
||||||
, wai
|
, wai
|
||||||
, wai-logger
|
, wai-logger
|
||||||
, wai-middleware-throttle
|
|
||||||
, yaml
|
, yaml
|
||||||
, optparse-applicative
|
, optparse-applicative
|
||||||
, case-insensitive
|
, case-insensitive
|
||||||
|
|
Loading…
Reference in a new issue