diff options
| author | Kostya <mail@sartin.in> | 2026-10-11 17:15:39 +0300 |
|---|---|---|
| committer | Kostya <mail@sartin.in> | 2026-10-11 17:16:05 +0300 |
| commit | dc616e0f340f28b320253bf9a70778a07b885ffd (patch) | |
| tree | a0344816c99604f8d89b4eb3db31c6e98ae2db7f /ui-web/src/styles.css | |
| parent | 241fd5f0a46aff89a3302d2753a01e217a562e79 (diff) | |
| download | guess-market-dc616e0f340f28b320253bf9a70778a07b885ffd.tar.gz guess-market-dc616e0f340f28b320253bf9a70778a07b885ffd.tar.xz guess-market-dc616e0f340f28b320253bf9a70778a07b885ffd.zip | |
server: add versioned sync endpoint for polling clients
The spec has clients pull updates every half second or so, by
fetching everything, only changes, or something in between. Take the
middle road: the engine keeps a version that moves on every change,
and GET /api/sync?since={version} answers {"changed": false} when
nothing has happened, which is almost every poll. Otherwise it returns
a snapshot of the event summaries, the user directory and the caller's
account, with the version to send next time. A client looking at one
event refetches its details from /api/events/{name} only when the
version moves.
The lock filter bumps the version after every state-changing request,
still inside the write lock, so a reader can never pick up new data
under an old version. CORS preflights now take the read lock, since
they change nothing. A session that times out also bumps the version,
so other users see that user go offline. The user directory rows move
into a helper that /api/users and the snapshot share.
Diffstat (limited to 'ui-web/src/styles.css')
0 files changed, 0 insertions, 0 deletions