|
1 | 1 | use super::NewService; |
| 2 | +use futures::future::Either; |
2 | 3 | use linkerd_error::Error; |
3 | 4 | use std::{ |
4 | 5 | future::Future, |
5 | 6 | pin::Pin, |
6 | 7 | task::{Context, Poll}, |
7 | 8 | }; |
8 | 9 | use tokio::time; |
9 | | -use tower::{spawn_ready::SpawnReady, util::Either}; |
| 10 | +use tower::spawn_ready::SpawnReady; |
10 | 11 | use tracing::{debug, trace}; |
11 | 12 |
|
12 | 13 | /// A service which falls back to a secondary service if the primary service |
@@ -100,12 +101,13 @@ where |
100 | 101 | Req: 'static, |
101 | 102 | A: tower::Service<Req> + Send + 'static, |
102 | 103 | A::Error: Into<Error>, |
103 | | - B: tower::Service<Req, Response = A::Response>, |
| 104 | + B: tower::Service<Req, Response = A::Response, Error = Error>, |
104 | 105 | B::Error: Into<Error>, |
105 | 106 | { |
106 | 107 | type Response = A::Response; |
107 | 108 | type Error = Error; |
108 | | - type Future = Either<<SpawnReady<A> as tower::Service<Req>>::Future, B::Future>; |
| 109 | + type Future = |
| 110 | + Either<<SpawnReady<A> as tower::Service<Req>>::Future, <B as tower::Service<Req>>::Future>; |
109 | 111 |
|
110 | 112 | fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { |
111 | 113 | loop { |
@@ -165,8 +167,8 @@ where |
165 | 167 | fn call(&mut self, req: Req) -> Self::Future { |
166 | 168 | trace!(state = ?self.state, "SwitchReady::call"); |
167 | 169 | match self.state { |
168 | | - State::Primary => Either::A(self.primary.call(req)), |
169 | | - State::Secondary => Either::B(self.secondary.call(req)), |
| 170 | + State::Primary => Either::Left(self.primary.call(req)), |
| 171 | + State::Secondary => Either::Right(self.secondary.call(req)), |
170 | 172 | State::Waiting => panic!("called before ready!"), |
171 | 173 | } |
172 | 174 | } |
|
0 commit comments