Skip to content

Conversation

@0x00101010
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 28, 2025 00:28
@vercel
Copy link

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rollup-boost Ignored Ignored Preview Nov 28, 2025 0:28am

Copilot finished reviewing on behalf of 0x00101010 November 28, 2025 00:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the retry logic in the FlashblocksReceiverService to ensure continuous reconnection attempts, even in unexpected scenarios where the connection handling completes successfully.

Key Changes:

  • Changed from if let Err pattern that would break the loop on Ok(()) to a match statement that handles both error and success cases
  • Added defensive unwrap_or_else for backoff interval to handle the theoretical case where backoff returns None
  • Added explicit handling for the unexpected Ok(()) case with immediate reconnection and logging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"Flashblocks receiver connection ended unexpectedly with Ok(()), this should never happen. Reconnecting immediately."
);
self.metrics.reconnect_attempts.increment(1);
self.metrics.connection_status.set(0);
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider resetting the backoff in the Ok(()) branch to ensure clean state for the next reconnection attempt. Even though this case should never happen, if it does occur after several failed attempts with exponential backoff, the next error would use an inflated backoff interval.

Ok(()) => {
    // This should never happen - connect_and_handle should loop forever
    // or return an error. If we get here, reconnect immediately.
    error!(
        "Flashblocks receiver connection ended unexpectedly with Ok(()), this should never happen. Reconnecting immediately."
    );
    self.metrics.reconnect_attempts.increment(1);
    self.metrics.connection_status.set(0);
    backoff.reset(); // Reset backoff for clean state
    // Reconnect immediately without delay since this is unexpected
}
Suggested change
self.metrics.connection_status.set(0);
self.metrics.connection_status.set(0);
backoff.reset(); // Reset backoff for clean state

Copilot uses AI. Check for mistakes.
tokio::time::sleep(interval).await;
} else {
break;
match self.connect_and_handle(&mut backoff).await {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 changes were made here:

  1. remove the break part, we expect the receiver to always run unless the service gets shutdown
  2. Added some logging to help triage problems if it came up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant