asobi_chat_channel (asobi v0.72.6)
View SourceSummary
Functions
Every chat channel running on this node, with its current member count.
Functions
-spec channels() -> [#{channel_id := binary(), members := non_neg_integer()}].
Every chat channel running on this node, with its current member count.
Two ETS reads and one pg lookup per channel: no channel process is called,
so an operator listing channels cannot block behind one that is busy.
The registry is the source rather than pg:which_groups/1, which the console
this replaces used. pg drops a group when its last member leaves, so a
running channel nobody is currently joined to is simply absent there - and
the console asked the wrong scope besides, so its channel list was always
empty.
Capped at 1000 channels, the same ceiling asobi_leaderboards:boards/0
enumerates under, so the in-memory sort behind this stays bounded. []
before the chat supervisor has started, and members => 0 for every channel
when pg has not.
-spec get_history(binary(), pos_integer()) -> [map()].
-spec handle_call(term(), gen_server:from(), map()) -> {reply, term(), map(), pos_integer()}.
-spec handle_cast(term(), map()) -> {noreply, map(), pos_integer()}.
-spec handle_info(term(), map()) -> {noreply, map(), pos_integer()} | {stop, normal, map()}.
-spec init({binary(), binary()}) -> {ok, map(), pos_integer()}.
-spec start_link(binary(), binary()) -> gen_server:start_ret().