mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
server: fix race condition in reloadAppContext
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9788 GitOrigin-RevId: c6b9441e4f4e12fea6ad4e5b336f3231fc4494d2
This commit is contained in:
parent
d61d523f77
commit
1d8d934157
@ -276,11 +276,12 @@ updateAppStateRef ::
|
||||
(MonadIO m, MonadBaseControl IO m) =>
|
||||
AppStateRef impl ->
|
||||
L.Logger L.Hasura ->
|
||||
RebuildableAppContext impl ->
|
||||
RebuildableSchemaCache ->
|
||||
(RebuildableAppContext impl -> m (RebuildableAppContext impl, RebuildableSchemaCache)) ->
|
||||
m ()
|
||||
updateAppStateRef (AppStateRef lock cacheRef metadataVersionGauge) logger !newAppCtx !newSC =
|
||||
updateAppStateRef appStateRef@(AppStateRef lock cacheRef metadataVersionGauge) logger action =
|
||||
withMVarMasked lock $ const do
|
||||
rebuildableAppContext <- liftIO $ readAppContextRef appStateRef
|
||||
(!newAppCtx, !newSC) <- action rebuildableAppContext
|
||||
liftIO do
|
||||
-- update schemacache in IO reference
|
||||
modifyIORef' cacheRef $ \appState ->
|
||||
|
Loading…
Reference in New Issue
Block a user