From 27c8758ea33d225a1f4ba620c61ae32587b11f6d Mon Sep 17 00:00:00 2001 From: mbays Date: Fri, 3 May 2024 00:00:00 +0000 Subject: [PATCH] Handle 44 response with exponential backoff --- LineClient.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LineClient.hs b/LineClient.hs index 5ec7edc..06b2996 100644 --- a/LineClient.hs +++ b/LineClient.hs @@ -19,6 +19,7 @@ module LineClient (lineClient) where import qualified Codec.MIME.Parse as MIME import qualified Codec.MIME.Type as MIME import Control.Applicative (Alternative, empty) +import Control.Concurrent (threadDelay) import Control.Monad (forM_, guard, join, mplus, msum, mzero, unless, void, when, (<=<)) import Control.Monad.Catch (SomeException, bracket, @@ -841,6 +842,10 @@ handleCommandLine addIdentity req identity doRequest redirs req + handleResponse (Failure 44 info) = do + printInfo $ "Server requests slowdown: " ++ info + liftIO . threadDelay $ 1000 * 2^redirs + doRequest (redirs+1) req handleResponse (Failure code info) = printErr $ "Server returns failure: " ++ show code ++ " " ++ info handleResponse (MalformedResponse malformation) = -- 2.11.4.GIT