Repository for testing the graceful exit behavior in Elixir app
How to test localy:
iex -S mix
ormix release & _build/dev/rel/graceful_exit/bin/graceful_exit start
- (in another terminal window)
ps
and grab PID ofbeam
- (in another terminal window)
kill PID
- that sendsSIGTERM
signal to the application
Behavior on SIGTERM signal:
- terminate callback isn't called
- after 10 seconds (shutdown time option) exits
Behavior on SIGTERM signal:
- terminate callback is called
- exits after the terminate callback finishes
iex -S mix
s = GracefulExit.ItemProcessingSupervisor
- start the first task
DynamicSupervisor.start_child(s, {GracefulExit.AsyncWorker, Enum.to_list(1..60)})
- start the second task
DynamicSupervisor.start_child(s, {GracefulExit.AsyncWorker, Enum.to_list(1..60)})
- (in another terminal window)
ps
and grab PID ofbeam
- (in another terminal window)
kill PID
- that sendsSIGTERM
signal to the application
iex -S mix
s = GracefulExit.ItemProcessingSupervisor
DynamicSupervisor.start_child(s, {GracefulExit.AsyncWorker, Enum.to_list(1..5)})
- wait ~5 seconds
DynamicSupervisor.count_children(s)