From b111c4d47a943829de11eaecad4cc53bdf218c03 Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 29 Sep 2022 02:39:15 +0200 Subject: [PATCH] remove throttler and its dependencies --- app/Main.hs | 16 +--------------- flake.nix | 6 ++---- mateamt.cabal | 1 - 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 63871e3..a31aec4 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -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 diff --git a/flake.nix b/flake.nix index 91e2f03..367ffb3 100644 --- a/flake.nix +++ b/flake.nix @@ -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)); }; }; diff --git a/mateamt.cabal b/mateamt.cabal index f55a704..e8522dd 100644 --- a/mateamt.cabal +++ b/mateamt.cabal @@ -157,7 +157,6 @@ executable mateamt , warp , wai , wai-logger - , wai-middleware-throttle , yaml , optparse-applicative , case-insensitive