GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(run-engine): retry getSnapshotsSince on the replica then primary when the read replica lags by d-cs · Pull Request #3889 · triggerdotdev/trigger.dev Conversation
Collaborator
SummaryWhen Design
Test planAll vitest + testcontainers, no mocks. A new
🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR implements replica-aware snapshot polling for the Run Engine. When read-replica snapshots are enabled, 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… for replica-lag tests Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…edundant cast Co-Authored-By: Claude Fable 5 <[email protected]>
…ionSnapshotsSince Co-Authored-By: Claude Fable 5 <[email protected]>
…lica misses the since snapshot Co-Authored-By: Claude Fable 5 <[email protected]>
…p fallback without a replica Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
… and counter semantics for getSnapshotsSince Co-Authored-By: Claude Fable 5 <[email protected]>
…note, trim dead test setup Co-Authored-By: Claude Fable 5 <[email protected]>
… a different run (red) Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…ment Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…etSnapshotsSince Co-Authored-By: Claude Fable 5 <[email protected]>
…stinguish fallback failure logs Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…ds, tie-stable test assertions, shared clone/drop helpers Co-Authored-By: Claude Fable 5 <[email protected]>
a26a5f0 to
f4dac20
Compare
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/plugins
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Critical path: before / afterHow a runner's Before (why enabling the flag was previously unsafe)sequenceDiagram
participant R as Runner
participant E as Webapp / RunEngine
participant RO as Read replica
participant P as Primary (writer)
R->>E: poll since snap_X
E->>RO: findFirst(snap_X)
RO-->>E: ✗ not replicated yet
Note over E: ERROR log → alert noise
E-->>R: 500
Note over R: wait for next poll interval (~5s)<br/>notification path degrades to polling
R->>E: poll again
E->>RO: findFirst(snap_X)
RO-->>E: ✓ replicated by now
E-->>R: 200 + snapshots
Cost per lag hit: error spam + alert noise + up to a full poll interval of added latency on the snapshot transition. After (this PR)sequenceDiagram
participant R as Runner
participant E as Webapp / RunEngine
participant RO as Read replica
participant P as Primary (writer)
R->>E: poll since snap_X
E->>RO: findFirst(snap_X)
RO-->>E: ✗ not replicated yet
Note over E: sleep 50–200ms (jittered, configurable.<br/>MAX_MS=0 skips straight to primary)
E->>RO: retry findFirst(snap_X)
alt replica caught up (common case)
RO-->>E: ✓ snapshots
Note over E: counter++ outcome=replica_retry (quiet)
E-->>R: 200 + snapshots
else lag outlasts the retry window
RO-->>E: ✗ still missing
E->>P: full query on the writer
P-->>E: ✓ snapshots
Note over E: counter++ outcome=primary + WARN (writer spill)
E-->>R: 200 + snapshots
else permanent miss (bogus / pruned id, or wrong run)
RO-->>E: ✗ still missing
E->>P: full query on the writer
P-->>E: ✗ not found
Note over E: ERROR log — unchanged from today
E-->>R: 500
end
Cost per lag hit: ≤ ~200ms added latency; the writer is only touched when lag outlasts the retry window. Invariants
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…eplica retry Co-Authored-By: Claude Fable 5 <[email protected]>
|
@d-cs probably doesn't need 2 server changes files 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…entry Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…the writer fallback Co-Authored-By: Claude Fable 5 <[email protected]>
|
Combined into a single server-changes entry in 51924bb. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Fable 5 <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.