feat: replace TxPoller polling with SSE streaming#259
Draft
Conversation
Switch TxPoller from 1s timer-based polling to SSE streaming for real-time transaction delivery. The new lifecycle: 1. Full fetch of all transactions at startup 2. SSE stream for real-time new transaction delivery 3. Full refetch on each block environment change Adds exponential backoff (1s-30s) on SSE reconnection to prevent tight loops when the endpoint is unavailable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Expand tokio import for nightly rustfmt, remove unresolved `CacheTask` rustdoc link. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the 1s timer-based polling loop in
TxPollerwith SSE streaming for real-time transaction delivery from the tx-pool. The new task lifecycle:/transactions/feed) pushes new transactions as they arrive β no more redundant refetchesOn SSE disconnect or error, the poller reconnects with exponential backoff (1s initial, doubling up to 30s cap) and does a full refetch to cover the gap. Backoff resets on each successfully received transaction.
Changes
Cargo.toml: enablessefeature oninit4-bin-base(transitively enablessignet-tx-cache/sse)src/tasks/cache/tx.rs: rewriteTxPollerβ replace poll loop withfull_fetch()+subscribe()+select!over SSE items and block env changes. Addreconnect()with exponential backoff. Removepoll_interval_ms,poll_duration(),Defaultimpl.src/tasks/cache/system.rs: passblock_envwatch receiver toTxPoller::new()tests/tx_poller_test.rs: update integration test to useTxCachedirectly (no morecheck_tx_cache()method)BundlePolleris unchanged β the/bundles/feedserver endpoint is not yet available.Test plan
make clippypasses cleanmake testβ all 8 unit tests pass, integration tests correctly ignoredπ€ Generated with Claude Code