mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-14 03:45:47 +01:00
Keep using old Stack versions on API failures
This commit is contained in:
parent
b80a7f9a52
commit
3393217f66
@ -38,7 +38,7 @@ import Network.Wai.Middleware.RequestLogger (Destination(Logger),
|
|||||||
IPAddrSource(..), OutputFormat(..),
|
IPAddrSource(..), OutputFormat(..),
|
||||||
destination, mkRequestLogger,
|
destination, mkRequestLogger,
|
||||||
outputFormat)
|
outputFormat)
|
||||||
import RIO (LogFunc, LogOptions, logOptionsHandle, withLogFunc, runRIO, logError)
|
import RIO (LogFunc, LogOptions, logOptionsHandle, withLogFunc, runRIO, logError, displayShow)
|
||||||
import RIO.Prelude.Simple (runSimpleApp)
|
import RIO.Prelude.Simple (runSimpleApp)
|
||||||
import Stackage.Database (withStackageDatabase)
|
import Stackage.Database (withStackageDatabase)
|
||||||
import Stackage.Database.Cron (newHoogleLocker, singleRun)
|
import Stackage.Database.Cron (newHoogleLocker, singleRun)
|
||||||
@ -152,11 +152,14 @@ withFoundation appLogFunc appSettings inner = do
|
|||||||
grRefresh appWebsiteContent
|
grRefresh appWebsiteContent
|
||||||
withStackageDatabase (appShouldLogAll appSettings) pgConf $ \appStackageDatabase -> do
|
withStackageDatabase (appShouldLogAll appSettings) pgConf $ \appStackageDatabase -> do
|
||||||
appLatestStackMatcher <-
|
appLatestStackMatcher <-
|
||||||
mkAutoUpdate
|
mkAutoUpdateWithModify
|
||||||
defaultUpdateSettings
|
defaultUpdateSettings
|
||||||
{ updateFreq = 1000 * 1000 * 60 * 30 -- update every thirty minutes
|
{ updateFreq = 1000 * 1000 * 60 * 30 -- update every thirty minutes
|
||||||
, updateAction = getLatestMatcher appHttpManager
|
, updateAction = getLatestMatcher appHttpManager
|
||||||
}
|
}
|
||||||
|
\oldMatcher -> getLatestMatcher appHttpManager `catchAny` \e -> do
|
||||||
|
runRIO appLogFunc $ RIO.logError $ "Couldn't get Stack matcher: " <> displayShow e
|
||||||
|
pure oldMatcher
|
||||||
appHoogleLock <- newMVar ()
|
appHoogleLock <- newMVar ()
|
||||||
appMirrorStatus <- mkUpdateMirrorStatus
|
appMirrorStatus <- mkUpdateMirrorStatus
|
||||||
hoogleLocker <- newHoogleLocker appLogFunc appHttpManager
|
hoogleLocker <- newHoogleLocker appLogFunc appHttpManager
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user