...

/

GenServer Callbacks: terminate

GenServer Callbacks: terminate

Learn how the GenServer ends running processes using the terminate callback.

The terminate callback function

The terminate/2 callback is usually invoked before the process exits, but only when the process itself is responsible for the exit. Most often, the exit results from explicitly returning {:stop, reason, state} from a callback (excluding init/1). It can also happen when an unhandled exception ...