diff --git a/package.yaml b/package.yaml index 4669928..b5af0f2 100644 --- a/package.yaml +++ b/package.yaml @@ -90,6 +90,7 @@ dependencies: - file-embed - resource-pool - containers +- retry default-extensions: - OverloadedStrings diff --git a/src/Stackage/Database/Cron.hs b/src/Stackage/Database/Cron.hs index 6cd2e70..6ddc262 100644 --- a/src/Stackage/Database/Cron.hs +++ b/src/Stackage/Database/Cron.hs @@ -63,7 +63,7 @@ import Stackage.Database.Types import System.Environment (lookupEnv) import UnliftIO.Concurrent (getNumCapabilities) import Web.PathPieces (fromPathPiece, toPathPiece) - +import qualified Control.Retry as Retry hoogleKey :: SnapName -> Text @@ -143,7 +143,9 @@ newHoogleLocker env man = mkSingleRun hoogleLocker getHackageDeprecations :: (HasLogFunc env, MonadReader env m, MonadIO m) => m [Deprecation] getHackageDeprecations = do - jsonResponseDeprecated <- httpJSONEither hackageDeprecatedUrl + let policy = Retry.exponentialBackoff 50 <> Retry.limitRetries 5 + jsonResponseDeprecated <- + liftIO $ Retry.recoverAll policy $ const $ httpJSONEither hackageDeprecatedUrl case getResponseBody jsonResponseDeprecated of Left err -> do logError $