You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks good. ✅ The change correctly addresses the goal: long-lived spawned tasks (current_block_stream, current_block_ws_stream, token_fetcher) no longer wrap their whole lifetime in a span that never closes. Instead, #[instrument(skip_all)] is applied to the per-iteration units of work (convert_block_and_process, fetch_block_and_process, update_balances), so spans open and close once per block / per poll / per update cycle.
The refactor of the two block-stream loops into the shared handle_new_block helper is a nice deduplication and I verified it preserves the original control flow exactly:
update_current_block_metrics still runs for every observed block (before the hash check).
Same-hash blocks are ignored; update_block_metrics runs only on hash change; the stream is updated + previous_block advanced only when the block number increases.
The panic-on-send-failure behavior is unchanged (both loops).
Types are consistent (AlloyProvider, get_block_at_id(&AlloyProvider, ...)), and the tracing::Instrument → tracing::instrument import swaps match the new usage in both files.
Minor observations (non-blocking, no change needed):
The debug log message was unified from "received block" / "polled block" to "observed new block". Since both loops now share code this is expected; the span/task naming still lets you tell WS vs. polling apart.
BlockInfo::try_from(block.clone()) still clones to retain block for the error log — pre-existing, not introduced here.
I couldn't run cargo check/cargo +nightly fmt in this environment (command approval not granted), so please rely on CI for the final build/format check.
• dont-instrument-long-tasks-2
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 freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
hotfixLabels PRs that should be applied into production right away
2 participants
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.
Description
Follow up to #4680 as I overlooked to background tasks.
Changes
adjusted instrumentation of current block stream and token fetcher
also slightly refactored current block stream to reuse duplicated code