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
/// // Make it `Clone` by putting a channel in front
/// let buffered = Buffer::new(svc, 1024);
///
/// // Convert it into a `MakeService`
/// let make = Shared::new(buffered);
In this example, if svc.poll_ready returns Poll::Ready(Err(_)), then buffered.poll_ready will propagate it and stop calling the inner service, since it is no good anymore.
make however, will keep returning Poll::Ready(Ok(())) and cloning the bad buffered service.
I could not find a way to make the shared service detect this scenario, so I ended up implementing my own shared service with some basic recover logic.
In this scenario, I understand that both svc and buffered should be dropped. The layer above them should be notified somehow so it could try to recover or just propagate the error all the way to the top.
Did I get it right? If yes, then I would say Shared and Buffered don't play well together, and I would also suggest changing the example in the docs.
cheer!
The text was updated successfully, but these errors were encountered:
Hi there,
I am trying to combine Buffer and Shared as described in the Shared service doc:
tower/tower/src/make/make_service/shared.rs
Lines 59 to 65 in 7f004da
In this example, if
svc.poll_ready
returnsPoll::Ready(Err(_))
, thenbuffered.poll_ready
will propagate it and stop calling the inner service, since it is no good anymore.make
however, will keep returningPoll::Ready(Ok(()))
and cloning the badbuffered
service.tower/tower/src/make/make_service/shared.rs
Lines 91 to 97 in 7f004da
I could not find a way to make the shared service detect this scenario, so I ended up implementing my own shared service with some basic recover logic.
In this scenario, I understand that both
svc
andbuffered
should be dropped. The layer above them should be notified somehow so it could try to recover or just propagate the error all the way to the top.Did I get it right? If yes, then I would say
Shared
andBuffered
don't play well together, and I would also suggest changing the example in the docs.cheer!
The text was updated successfully, but these errors were encountered: