Commit f8f8522
authored
feat: add allocation reconciliation (#882)
* feat(tap-agent): add periodic allocation reconciliation
Add a background task that periodically triggers allocation
reconciliation to ensure recovery after subgraph connectivity issues.
Previously, the allocation watcher was purely event-driven
and only fired when the allocation list changed. If allocations were
closed during a connectivity outage and the list became static afterward,
no messages would fire and stale SenderAllocation actors would keep
running, never triggering mark_rav_last().
This change adds:
- New config option
(default: 5 min)
- ReconcileAllocations message type for SenderAccount
- Periodic task that sends ReconcileAllocations every
interval
- Handler that forces re-check of all allocations against
the watcher
This ensures closed allocations are detected and RAVs are
properly marked
as 'last' for redemption, even after connectivity issues.
* test(tap-agent): add tests and validation for allocation reconciliation
- Add unit test for ReconcileAllocations message handling that verifies
it triggers UpdateAllocationIds with current allocations from watcher
- Add config validation for allocation_reconciliation_interval_secs:
error if 0, warn if < 60s
- Add test for periodic task lifecycle verifying task spawn/abort
- Update create_sender_account() test helper to expose
indexer_allocations_tx and configurable reconciliation interval
- Add tokio test-util feature for time control in tests
* chore(tap-agent): add observability improvements for allocation reconciliation
- Add ALLOCATION_RECONCILIATION_RUNS counter metric
- Elevate reconciliation logs from debug to info
- Enhance config documentation explaining the connectivity failure
scenario1 parent d9e7d3e commit f8f8522
File tree
6 files changed
+401
-20
lines changed- crates
- config/src
- tap-agent
- src
- agent
- tests
6 files changed
+401
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| |||
441 | 455 | | |
442 | 456 | | |
443 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
444 | 475 | | |
445 | 476 | | |
446 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
0 commit comments