Fix dropping schema cache reload notifications

* test: bad schema reload
* refactor: DRY using the "extra" lib
* refactor: move worker funtions inside AppState
* Also rename Workers.hs to Admin.hs
This commit is contained in:
Steve Chavez
2023-06-02 12:22:17 -05:00
committed by GitHub
parent 14be3fb671
commit a852b766eb
15 changed files with 460 additions and 409 deletions
+2 -3
View File
@@ -14,7 +14,6 @@ import System.Posix.Files (setFileMode)
import System.Posix.Types (FileMode)
import qualified PostgREST.AppState as AppState
import qualified PostgREST.Workers as Workers
import Protolude
@@ -49,10 +48,10 @@ installSignalHandlers appState = do
-- The SIGUSR1 signal updates the internal 'SchemaCache' by running
-- 'connectionWorker' exactly as before.
install Signals.sigUSR1 $ Workers.connectionWorker appState
install Signals.sigUSR1 $ AppState.connectionWorker appState
-- Re-read the config on SIGUSR2
install Signals.sigUSR2 $ Workers.reReadConfig False appState
install Signals.sigUSR2 $ AppState.reReadConfig False appState
where
install signal handler =
void $ Signals.installHandler signal (Signals.Catch handler) Nothing