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

User: use a stably-ordered queue for long-polling #234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mokomull
Copy link

If the AJAX request for LongPollServlet happens with enough of a delay,
there may be two stateful messages in the queue -- I have observed two
GAME_STATE_CHANGE messages enqueued simultaneously when the Card Czar
does not long-poll while the other players progress the game through
PLAYING to JUDGING. The JS code overwrites the state as it iterates the
list, so the "last state wins". But PriorityQueue explicitly does
not guarantee any particular ordering among elements that compare
"equal", causing the client to think the game is PLAYING.

Testing done

This avoids one flavor of error in a local client I'm developing, but to be honest, I'm still not finished debugging all of the other state-machine issues that it had.

If the AJAX request for LongPollServlet happens with enough of a delay,
there may be two stateful messages in the queue -- I have observed two
GAME_STATE_CHANGE messages enqueued simultaneously when the Card Czar
does not long-poll while the other players progress the game through
PLAYING to JUDGING.  The JS code overwrites the state as it iterates the
list, so the "last state wins".  But PriorityQueue<E> explicitly does
not guarantee any particular ordering among elements that compare
"equal", causing the client to think the game is PLAYING.
@ajanata
Copy link
Owner

ajanata commented May 24, 2020

yeah I don't think there's really much of a point to having a priority to the messages... it was a good idea but perhaps a bit premature and wasn't useful. heck the entire MessageType can probably be removed, since its point was to prioritize messages in this queue

Copy link
Owner

@ajanata ajanata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanna merge this, but my brain can't handle merge conflicts right now

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

Successfully merging this pull request may close these issues.

2 participants