Conversation
|
There are two things that I found out:
tokio::spawn(async move {
futures::StreamExt::for_each_concurrent(
ReceiverStream::new(recv_req),
max_concurrency,
|request: Result<T>| async {
let request = request.expect("cannot read request");
let response = handle(&mut client, cache.clone(), request).await;
send_resp
.send(response)
.await
.expect("cannot send response to queue");
},
)
.await;
});First it can't pass a mutable reference to But before going into that rabbit hole, I thought I'd ask about the generic type parameters and what your intention was :) Maybe that makes a few things more clear to me |
|
Thanks a lot for your comment. I really appreciate the support. The idea behind the generic type was that I didn't want to be dependent on any single request implementation (that of reqwest or any other). However in hindsight that is unnecessary because we fully control the internals of the library and could change it if we wanted to, which is - quite frankly - unlikely. With that in mind, let's change it back to the concrete type if it makes things easier. As for Maybe if we use a concrete type and |
|
Closing this as I don't see it getting merged anytime soon. I want to revisit this idea at some point once I'm a bit clearer of what I want to achieve by moving to Tower. We got better retry-handling now and the middleware part is still a bit far in the future, so no need to merge a rushed design. Thanks, @ddprrt, for the feedback and support, though! |
This is an attempt to move the request client to tower.
In the future this will help us with
improved retry handlingBetter retry handling #981Thanks to @ddprrt for the support to fix the compilation issues.