Changeset f889429 in Klonkt
- Timestamp:
- 08/07/2026 10:57:55 AM (5 weeks ago)
- Branches:
- main
- Children:
- ea138c0
- Parents:
- 31e63d1
- git-author:
- Robin <roboburr@…> (08/07/2026 10:57:53 AM)
- git-committer:
- roboburr <roboburr@…> (08/07/2026 10:57:55 AM)
- Files:
-
- 2 edited
-
docs/shaer-c2s-api.md (modified) (1 diff)
-
src/routes/activitypub.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
docs/shaer-c2s-api.md
r31e63d1 rf889429 96 96 - Send neither and the route behaves exactly as it always did. 97 97 98 The answer arrives as soon as anything the inbox would show has changed, or when 99 `wait` runs out — whichever comes first. Either way it is the full, current 100 collection with a fresh `shaer:cursor`. An empty-handed return is not an error: 101 it means nothing happened, ask again. 98 Two possible answers: 99 100 | | | 101 |---|---| 102 | **`200`** | something changed. The full, current collection with a fresh `shaer:cursor`. | 103 | **`304`** | nothing changed within `wait`. **No body.** Keep the cursor you have and ask again. | 104 105 `304` is not an error — it is the normal answer to a quiet minute, and it is why 106 this costs nothing while nothing happens. Sending the whole timeline back every 107 `wait` seconds just to say "still nothing" would be a poor trade for saving one 108 round trip. 109 110 A server that has not run the feed-state migration yet cannot tell change from 111 stillness, and answers `200` with the collection every time rather than `304` 112 forever. Slower, never wrong. 102 113 103 114 The cursor moves for **all four** sources this read merges: the timeline, -
src/routes/activitypub.js
r31e63d1 rf889429 285 285 const afbreken = new AbortController(); 286 286 res.on('close', () => afbreken.abort()); // client hing op: niet doorgaan met wachten 287 await AP.waitForFeedChange(auth.site.slug, {287 const uit = await AP.waitForFeedChange(auth.site.slug, { 288 288 since: String(req.query.since), waitMs: wachtS * 1000, signal: afbreken.signal, 289 289 }); 290 290 if (res.writableEnded || afbreken.signal.aborted) return undefined; 291 // Niets veranderd? Dan een LEEG antwoord (Barts punt): de hele collectie 292 // terugsturen terwijl er niets gebeurd is, is elke 25 seconden een tijdlijn 293 // over de mobiele verbinding voor niets. Met 304 kost stilte niets en kost 294 // nieuws nog steeds maar één rondje -- beter dan een apart seintje-endpoint, 295 // dat voor nieuws twee rondjes nodig heeft. 296 // 297 // De '0'-uitzondering is geen franje. Ontbreekt ap_feed_state (een instance 298 // die de migratie nog niet draaide), dan geeft feedCursor altijd '0' terug, 299 // en zou een client hier eeuwig 304 krijgen en nooit meer inhoud zien. Bij 300 // een lege merksteen sturen we dus gewoon de collectie. 301 if (!uit.changed && uit.cursor !== '0') { 302 res.set('Vary', 'Authorization'); 303 return res.status(304).end(); 304 } 291 305 } 292 306 // Gated feature (FEP-633c): may this account see EXTERNAL embeds? A ward's
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)