aiotools
aiotools copied to clipboard
server: graceful reload and restart via SIGHUP/SIGUSR1 signals
- Graceful reload: when the main program receives SIGUSR1, let it shutdown all workers and extra processes, call a restart callback, and re-spawn all workers and extra processes again. A restart callback is intended to read the (changed) configuration again, which is written by the user.
- Graceful restart: when the main program receives SIGHUP, let it terminate completely and re-execute the whole process again, preferably with the same
sys.argvand environment variables. Add an optional restart callback which is called after terminating workers but before calling user-defined main exit handler.
There may be required several design decision on what arguments to pass to callbacks and when to call them. Let's discuss and implement.
https://github.com/achimnol/aiotools/pull/9