Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: return # of messages prioritized in the queue when calling message retry endpoint #5132

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kamiyaa
Copy link
Collaborator

@kamiyaa kamiyaa commented Jan 9, 2025

Description

Add a mpsc channel between relayer and message retry handler, so message retry handler knows the retry results from the relayer.

POST /message_retry endpoint now returns a JSON with details on the retry request:

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct MessageRetryResponse {
    /// ID of the retry request
    pub uuid: String,
    /// how many pending operations were processed
    pub processed: usize,
    /// how many of the pending operations matched the retry request pattern
    pub matched: u64,
}

New changes

  • added explicit drop() call to transmitter
  • changed channel size to 3 * number of destination chains
    • before it was just number of origin chains
    • this should prevent Senders from being blocked when calling send()
  • added unittests to test process_retry_requests to ensure messages are being matched properly against MatchingList

Drive-by changes

Related issues

Fixes #4059

Backward compatibility

Testing

Updated unit tests to return a response so the handler is not blocked

Copy link

changeset-bot bot commented Jan 9, 2025

⚠️ No Changeset found

Latest commit: 1bbd92f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.53%. Comparing base (286b4de) to head (1bbd92f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5132   +/-   ##
=======================================
  Coverage   77.53%   77.53%           
=======================================
  Files         103      103           
  Lines        2110     2110           
  Branches      190      190           
=======================================
  Hits         1636     1636           
  Misses        453      453           
  Partials       21       21           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 79.39% <ø> (ø)
isms 83.68% <ø> (ø)
token 91.27% <ø> (ø)
middlewares 79.80% <ø> (ø)

@kamiyaa kamiyaa force-pushed the jeff/message-retry branch from 96a33bb to 831a111 Compare January 9, 2025 11:20
debug!(
uuid = retry_req.uuid,
?op,
pattern = ?retry_req.pattern, "Matched retry request");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added more informative debug messages so we know which requests and patterns are being matched.
I hope this isn't the reason why the endpoint is slow now


// we only need to lock self.retry_receiver once
{
let mut retry_receiver = self.retry_receiver.lock().await;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure if this really matters but I think this way, we only lock once instead of on each iteration


#[tracing_test::traced_test]
#[tokio::test]
async fn test_process_retry_requests_by_id() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tests to make sure we aren't retrying all messages

@kamiyaa kamiyaa marked this pull request as ready for review January 9, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

Relayer retry API: add the # of messages prioritized in the queue to the http response
1 participant