Skip to content

fix(elixir): Set up the timers outside of the channels #176

@mrapacz

Description

@mrapacz

Type

Bug

Current behaviour
The timers are set up as :timer.send_after in channels/room. The problem is that if the first user joins the room and leaves it, the timer gets cancelled.

Expected behaviour
The timers shouldn't depend on people joining or leaving the room (apart from the case when the room is closed).

The timers could be implemented using quantum, but I guess it would end up being really hacky.

Instead I think we may just introduce a GenServer that will be called whenever a question is changed (we could also transform QuestionChronicle to be sort of RoomStateGuard), which would invoke the broadcast/3 function and the sockets would handle it accordingly.

I think it would actually be a good idea architecture-wise - making the whole game operate in socket area only does not seem to be very stable.

Motivation / use case
Unbugging

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions