View Source HanoiWeb.Session.Purge (Towers of Hanoi v1.0.0)

Purges per-session TowerState GenServer process and ETS table when no longer needed.

To make sure these don't build up over time, we check for last used time (created, or last move). Every purge_gap, a process runs looking for old sessions - that is last used > purge_time - and deletes them.

Summary

Functions

Returns a specification to start this module under a supervisor.

Function collects all the current game sessions, filters by age and deletes old ones. It then calls itself creating continuous loop of purging.

Stores :purge_time in GenServer state. Sends first message to :run_purge, starting the continuous purging cycle.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Function collects all the current game sessions, filters by age and deletes old ones. It then calls itself creating continuous loop of purging.

Stores :purge_time in GenServer state. Sends first message to :run_purge, starting the continuous purging cycle.