postgrest-8.0.0: REST API for any Postgres database
Safe HaskellNone
LanguageHaskell2010

PostgREST.Workers

Synopsis

Documentation

connectionWorker :: AppState -> IO () Source #

The purpose of this worker is to obtain a healthy connection to pg and an up-to-date schema cache(DbStructure). This method is meant to be called multiple times by the same thread, but does nothing if the previous invocation has not terminated. In all cases this method does not halt the calling thread, the work is preformed in a separate thread.

Background thread that does the following : 1. Tries to connect to pg server and will keep trying until success. 2. Checks if the pg version is supported and if it's not it kills the main program. 3. Obtains the dbStructure. If this fails, it goes back to 1.

reReadConfig :: Bool -> AppState -> IO () Source #

Re-reads the config plus config options from the db

listener :: AppState -> IO () Source #

Starts a dedicated pg connection to LISTEN for notifications. When a NOTIFY db-channel - with an empty payload - is done, it refills the schema cache. It uses the connectionWorker in case the LISTEN connection dies.