diff --git a/main/Main.hs b/main/Main.hs index a66c9c07efe..15c15c8a487 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -126,7 +126,7 @@ main = do -- This is passed to the connectionWorker method so it can kill the main thread if the PostgreSQL's version is not supported. mainTid <- myThreadId - let connWorker = connectionWorker mainTid pool refConf refDbStructure refIsWorkerOn (dbChannelEnabled, mvarConnectionStatus) + let connWorker = connectionWorker mainTid pool refConf refDbStructure refIsWorkerOn (dbChannelEnabled, mvarConnectionStatus) $ configRereader False -- Sets the initial refDbStructure connWorker @@ -211,7 +211,8 @@ connectionWorker -> IORef Bool -- ^ Used as a binary Semaphore -> (Bool, MVar ConnectionStatus) -- ^ For interacting with the LISTEN channel -> IO () -connectionWorker mainTid pool refConf refDbStructure refIsWorkerOn (dbChannelEnabled, mvarConnectionStatus) = do + -> IO () +connectionWorker mainTid pool refConf refDbStructure refIsWorkerOn (dbChannelEnabled, mvarConnectionStatus) cfRereader = do isWorkerOn <- readIORef refIsWorkerOn unless isWorkerOn $ do -- Prevents multiple workers to be running at the same time. Could happen on too many SIGUSR1s. atomicWriteIORef refIsWorkerOn True @@ -227,6 +228,7 @@ connectionWorker mainTid pool refConf refDbStructure refIsWorkerOn (dbChannelEna NotConnected -> return () -- Unreachable because connectionStatus will keep trying to connect Connected actualPgVersion -> do -- Procede with initialization putStrLn ("Connection successful" :: Text) + cfRereader scStatus <- loadSchemaCache pool actualPgVersion refConf refDbStructure case scStatus of SCLoaded -> pure () -- do nothing and proceed if the load was successful