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

Remove delivery extraction, enable easy consumer timeout and concurrent task creation #35

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

Victor-N-Suadicani
Copy link
Contributor

  • Removes delivery extraction. This makes other extractors simpler and removes the possibility of many of them failing.
  • Adds a convenience method to set the x-consumer-timeout argument on queues.
  • Starts tasks concurrently rather one at a time for faster startup time.

Copy link
Contributor

@gorm-issuu gorm-issuu left a comment

Choose a reason for hiding this comment

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

One of the rare PRs that removes more code than it adds :)

Outside of the clone (and I could be wrong about that, github ui bothers me), I don't see any problems.

info!("Received request on handler {handler_name:?} from {app_id}");

if req.delivery.redelivered {
info!("Request was redelivered.");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@@ -126,13 +130,9 @@ async fn handle_request<H, S, Args, Res>(
let mut props = BasicProperties::default();

if let Some(correlation_id) = correlation_id {
props = props.with_correlation_id(correlation_id);
props = props.with_correlation_id(correlation_id.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the clone? I don't see it being used elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with_correlation_id takes ownership but the id is only a reference, that's why. There was also a clone previously if you check the diff above.

/// Note that when you extract the [`Acker`], the handler itself must acknowledge the request.
/// kanin *will not* acknowledge the request for you in this case.
// TODO: This implementation is quite hacky and should probably be removed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we have the option to set timeout on queues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@@ -17,9 +17,9 @@ pub struct Request<S> {
channel: Channel,
/// Request ID. This is a unique ID for every request. Either a newly created UUID or whatever
/// is found in the `req_id` header of the incoming AMQP message.
pub(crate) req_id: ReqId,
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason for this? Or just personal pref?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly just personal preference and for "fairness". kanin should implement extract in the same way as a downstream crate.

@Victor-N-Suadicani Victor-N-Suadicani merged commit 66f3f54 into main Feb 9, 2024
4 checks passed
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.

2 participants