Gracefull exit on sigTERM
Like the sigINT that was already handled, postgrest should gracefuly shut down on a sigTERM. This is a common way of stopping processes, used amongst others by docker. See: https://stackoverflow.com/questions/4042201/how-does-sigint-relate-to-the-other-termination-signals
This commit is contained in:
@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Terminate gracefully on SIGTERM - @recmo
|
||||||
|
|
||||||
## [0.3.1.0] - 2016-02-28
|
## [0.3.1.0] - 2016-02-28
|
||||||
|
|
||||||
|
|||||||
@@ -60,10 +60,11 @@ main = do
|
|||||||
|
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
tid <- myThreadId
|
tid <- myThreadId
|
||||||
void $ installHandler keyboardSignal (Catch $ do
|
forM_ [sigINT, sigTERM] $ \sig ->
|
||||||
P.release pool
|
void $ installHandler sig (Catch $ do
|
||||||
throwTo tid UserInterrupt
|
P.release pool
|
||||||
) Nothing
|
throwTo tid UserInterrupt
|
||||||
|
) Nothing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result <- P.use pool $ do
|
result <- P.use pool $ do
|
||||||
|
|||||||
Reference in New Issue
Block a user