Skip to content

Retry answers, order them per phone, and send phones totals only - #12

Open
irinanazarova wants to merge 1 commit into
mainfrom
answer-delivery
Open

irinanazarova wants to merge 1 commit into
mainfrom
answer-delivery

Conversation

@irinanazarova

Copy link
Copy Markdown
Collaborator

Three changes from comparing slide-quiz with other realtime voting apps.

A hung answer request no longer leaves the phone on "Sending...". The answer request had no timeout, and the audience page disables the buttons until it settles. Each attempt is now aborted after 8 seconds; network errors, timeouts, 408, 429 and 5xx are retried twice (about 1 and 2 seconds later, with jitter). A 4xx is not retried. The error is reported once, after the last attempt.

The presenter ignores an answer that arrives after the same phone's newer one. Every answer carries a seq (increasing per phone, saved in sessionStorage so it survives a reload and a clock that moved back). Retries reuse it. quiz-answer forwards it, and the presenter saves it with each session's vote. Answers without seq (older functions) are counted in arrival order, as before.

Phones get totals only. The sync payload sends { votes: {}, total } per question, since phones display only the total. The shape is unchanged, so 0.7.2 audience pages accept it.

Compatibility:

  • New phones (served from the @0.7 CDN range) with old functions: valibot strips the extra seq, so answers go through unchanged.
  • Old presenters with new phones: the extra seq is ignored.
  • A custom audience page reading per-option votes from ParticipantQuizManager now gets {}. This is in the changelog.

Tests:

  • Unit tests cover retries, timeouts, the 4xx case, disconnect during a retry, seq order (per phone and question, across a presenter reload and a phone reload), and the totals-only payload.
  • Two new integration tests against a real anycable-go: a hung answer request retried and counted once; an older answer reaching AnyCable after a newer one is ignored.

An answer request had no timeout, so on wifi that accepts a connection
and then carries nothing the phone stayed on "Sending..." with its
buttons disabled. Each attempt is now aborted after 8 seconds and
retried twice on a network error, timeout or server error.

Each answer carries a seq that increases per phone and survives a
reload; quiz-answer forwards it, and the presenter ignores an answer
older than one it already counted from that phone.

The sync broadcast carries only each question's total, which is all
phones display, so a busy free-text question no longer sends its whole
tally to every phone.
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.

1 participant