I'm making a simple game engine, which implements room manipulation.
I was thinking a lot and still have doubts that I'm making rooms not in the valid way.
Here's the scenario.
1) There's one static room, where users are able to 'register'.
2) after certain number of users are registered, it should create dynamic room and put these certain number of users in that room and make them quit the static room.
So, if we run this in multiple instances and let's say we're waiting for 2 users.
2 users join the static room -> create new room (in redis) -> enter these two players in that room (subscribe) -> make those players to leave static room (queue-like system).
Now what I think is a problem.
2 users join the static room -> before creating new room, one other player joins static room (different node instance) -> create new room -> move two players there -> other instance still thinks there's enough users to create new room -> something weird happens.
Is this correct? How should I implement the queue style room?