Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrapacz opened this issue Nov 13, 2017 · 0 comments
Open

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

mrapacz opened this issue Nov 13, 2017 · 0 comments

Comments

@mrapacz
Copy link
Collaborator

mrapacz commented Nov 13, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant