Skip to content

Commit

Permalink
fix: schema cache loading before the in-db config
Browse files Browse the repository at this point in the history
Fixes PostgREST#3660. Load the in-db config before the schema cache.

The regression happened on f09655b.
  • Loading branch information
steve-chavez committed Jul 29, 2024
1 parent b261abd commit 933a3a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PostgREST/AppState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,8 @@ getObserver = stateObserver
internalSchemaCacheLoad :: AppState -> IO ()
internalSchemaCacheLoad appState = do
AppConfig{..} <- getConfig appState
void $ retryingSchemaCacheLoad appState
-- We cannot retry reading the in-db config after it fails immediately, because it could have user errors. We just report the error and continue.
when configDbConfig $ readInDbConfig False appState
void $ retryingSchemaCacheLoad appState

-- | Try to load the schema cache and retry if it fails.
--
Expand Down Expand Up @@ -438,6 +437,7 @@ retryingSchemaCacheLoad appState@AppState{stateObserver=observer, stateMainThrea
oneSecondInUs = 1000000 -- one second in microseconds

-- | Reads the in-db config and reads the config file again
-- | We don't retry reading the in-db config after it fails immediately, because it could have user errors. We just report the error and continue.
readInDbConfig :: Bool -> AppState -> IO ()
readInDbConfig startingUp appState@AppState{stateObserver=observer} = do
AppConfig{..} <- getConfig appState
Expand Down

0 comments on commit 933a3a1

Please # to comment.