How Diarkis Server Handles Server Shutdown

When the Diarkis server receives the instruction to shutdown (SIGTERM), It changes its status to "OFFLINE" status.

Server Status Changes Automatically

The Diarkis server changes its status to "OFFLINE" when instructed to shut down. When the status changes to "OFFLINE", The server will be excluded from the response of Auth. (Diarkis HTTP server API to inform client for the endpoint to start real-time communication with Diarkis)

Also creating a new room and a group will be disabled when in the "OFFLINE" status.

This ensures the "OFFLINE" Diarkis server does not accept new clients. The Diarkis server still operates normally while it is in the "OFFLINE" status allowing the already connected clients to continue with what they were doing.

Server Notifies Connected Clients

The Diarkis server notifies connected clients when going into the "OFFLINE" status. The client raises the "OnOffline" event and the clients are recommended to re-connect to the Diarkis server cluster (This means connecting to a new different Diarkis server).

Server Waits For The Clients

The Diarkis UDP, TCP, and WebSocket server will suspend its shutdown process when going into "OFFLINE" status until all connected clients are gone.

This ensures the clients keep their connections as long as they need instead of terminating the connections resulting in service failure for those clients.

However, there is a shutdown timeout and when the timer reaches timeout, the Diarkis server will shut down regardless of the remaining connected clients.

You may change the shutdown timeout by changing the value of DIARKIS_SHUTDOWN_TIMEOUT (in seconds and default is 10 seconds) environment variable.

Last updated