Retry on HttpException in release check (#8909)

ConnectionTimeout gets thrown as HttpException which seems very
sensible to retry.

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2021-02-22 17:37:08 +01:00 committed by GitHub
parent c309ef915c
commit 8e8284c907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ import qualified Data.Foldable
import qualified Data.HashMap.Strict as H
import qualified Data.List
import qualified Data.List.Split as Split
import Data.Maybe (fromMaybe)
import Data.Maybe (fromMaybe, isJust)
import qualified Data.Ord
import qualified Data.SemVer
import qualified Data.Set as Set
@ -336,7 +336,7 @@ download_assets tmp release = do
retryPolicy = limitRetriesByCumulativeDelay (5 * 60 * 1000 * 1000) (exponentialBackoff (20 * 1000))
retryHandler status =
logRetries
(\(_ :: IOException) -> pure True) -- Dont try to be clever, just retry
(\e -> pure $ isJust (fromException @IOException e) || isJust (fromException @HTTP.HttpException e)) -- Dont try to be clever, just retry
(\shouldRetry err status -> IO.hPutStrLn IO.stderr $ defaultLogMsg shouldRetry err status)
status
downloadFile req manager url = HTTP.withResponse req manager $ \resp -> do