remove throttler and its dependencies

This commit is contained in:
nek0 2022-09-29 02:39:15 +02:00
parent e1d082e6e6
commit b111c4d47a
3 changed files with 3 additions and 20 deletions

View file

@ -37,7 +37,6 @@ import Network.Socket (defaultPort)
import Network.Wai
import Network.Wai.Logger
import Network.Wai.Handler.Warp
import Network.Wai.Middleware.Throttle
import Control.Monad.Reader
@ -144,20 +143,7 @@ main = do
, rsMailQueue = mailQueue
}
expirationSpec = TimeSpec 5 0 -- five seconds
throt = (defaultThrottleSettings expirationSpec)
{ 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))
runSettings settings (app initState)
where
opts = info (options <**> helper)
( fullDesc

View file

@ -14,11 +14,9 @@
haskellPackages = pkgs.haskellPackages.override {
overrides = hself: hsuper: {
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;
doJailbreak (unmarkBroken (dontCheck doJailbreak(hsuper.hspec-wai-json)));
token-bucket = with pkgs.haskell.lib;
doJailbreak (unmarkBroken (dontCheck doJailbreak(hsuper.token-bucket)));
unmarkBroken (dontCheck (doJailbreak hsuper.hspec-wai-json));
};
};

View file

@ -157,7 +157,6 @@ executable mateamt
, warp
, wai
, wai-logger
, wai-middleware-throttle
, yaml
, optparse-applicative
, case-insensitive