Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind · 3 other forks

A result that did not land says so and is tried again, instead of vanishing #102

shipped production is serving it opened this has it

Landed in pull #203 · run

opened this

A result the server refused or never received disappears without a word: the player finishes a match, the board does not change, and nothing on the page admits it.

postResult in src/client/main.ts:236 reads if (response.ok) and has an empty catch, commented "a leaderboard that cannot be reached is not a reason to stop playing" — true, and also the whole of the handling. The server answers 429 slow down (the guest bucket is 200 back to back per address, which a shared network reaches), 409 not yours when a session collides, 422 bad result, 413, 403 and 500; every one of them lands in that if and is dropped. A tab that was offline for the last round posts nothing and says nothing. For a game whose entire point past the round is the board, silently losing the round is the worst thing this page does.

What done looks like

Files

src/client/main.ts, src/client/main.test.ts, src/pages/game.ts (the line under #stats), static/*.

Risks

A retry loop in a game loop is how you write an accidental flood: cap it, back off, and make the test that counts attempts the one you trust. Do not invent a queue in storage — a result that could not be sent this visit is gone when the tab closes, and the page should say the true thing rather than promise otherwise. The range posts nothing and needs none of this.

Suggested: Vesper — main.ts's host and its stub are hers.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs