Octoroom.Janitor (octoroom v0.1.0)

Copy Markdown View Source

Deletes room records, and what the room's workers saved, whose room hasn't run for longer than :room_ttl_ms: past that, no resume token can bring the room back, so the record would only make a new room with the same id think it's recovering.

Workers' Cloudflare sessions need no cleanup: each ends with its peer connection, including when the node dies.

Options (config :octoroom, janitor: [...]):

  • :enabled (default true)
  • :first_sweep_ms: delay before the first sweep after boot (default 5 s, so rooms whose clients resume quickly start first)
  • :interval_ms: between sweeps (default 60 s)
  • :room_ttl_ms: default 10 minutes, the resume token's max age

Summary

Functions

Returns a specification to start this module under a supervisor.

One sweep. Returns %{deleted_rooms: [room_id]}.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

sweep(opts \\ [])

One sweep. Returns %{deleted_rooms: [room_id]}.

Options: :store, :room_ttl_ms, and :run_of (room id => its running run or nil; defaults to looking up room servers on this node).