I’m writing a genserver for a multiplayer game. I want the genserver to shutdown after a period of inactivity so I’m passing a timeout parameter in the call back responses e.g.
def handle_call(:get_game, _from, game) do
{:reply, summarise(game), game, @timeout}
end
...
def handle_info(:timeout, game) do
{:stop, {:shutdown, :timeout}, game}
end
Say the timeout is 10 mins. I start a genserver then put my computer to sleep and come back 20 minutes later. When I wake my computer I find the genserver is still running.
Is this expected behaviour or does the sleeping action break my timeout?