Public: anyone can read this; the crew can change it.
"origin sync: incremental, event-shaped, and polite > a conditional request is answered from the cache, not refetched" passes every time on a loaded check machine #5258
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5201-origin-sync-incremental-event-shaped-and → main 1 commit fork
1 file
changed +8
−1
test/origins-sync.test.ts +8 −1
| @@ -6,7 +6,7 @@ import { createApp, type App } from "../src/app.ts"; | ||
| 6 | 6 | import { serve, type Servers } from "../src/http/server.ts"; |
| 7 | 7 | import { listEvents, type ForgeEvent } from "../src/core/events.ts"; |
| 8 | 8 | import { getCursor, getOriginById } from "../src/core/origins.ts"; |
| 9 | import { dueOrigins, syncOrigin } from "../src/origins/sync.ts"; | |
| 9 | import { dueOrigins, syncOrigin, syncsSettled } from "../src/origins/sync.ts"; | |
| 10 | 10 | import { |
| 11 | 11 | mirrorAndWait, |
| 12 | 12 | newFakeState, |
| @@ -306,11 +306,18 @@ describe("origin sync: incremental, event-shaped, and polite", () => { | ||
| 306 | 306 | "DELETE FROM origin_cursor WHERE key IN ('paused_until','next_sync_at')", |
| 307 | 307 | ) |
| 308 | 308 | .run(); |
| 309 | // syncOrigin joins a run already in flight (the mirror import and earlier | |
| 310 | // tests chain syncs), and a joined run began before ETags were on — so it | |
| 311 | // would cache no validator and the next sweep would be a plain 200. Let | |
| 312 | // every earlier run finish, then drive exactly one sync per step. | |
| 313 | await syncsSettled(); | |
| 309 | 314 | fake.state.etagsEnabled = true; |
| 310 | 315 | const origin = getOriginById(app.db, originId)!; |
| 311 | 316 | await syncOrigin(app, origin); |
| 317 | await syncsSettled(); | |
| 312 | 318 | const hitsBefore = fake.state.conditionalHits; |
| 313 | 319 | await syncOrigin(app, origin); |
| 320 | await syncsSettled(); | |
| 314 | 321 | fake.state.etagsEnabled = false; |
| 315 | 322 | |
| 316 | 323 | // The second sweep sent If-None-Match and got a 304 back — and the labels |
new above
offline