-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fetch: replace futures-timer with tokio-timer #9066
Conversation
ee8a082
to
977d045
Compare
util/fetch/src/client.rs
Outdated
@@ -142,6 +142,7 @@ type ChanItem = Option<(Request, Abort, TxResponse)>; | |||
pub struct Client { | |||
core: mpsc::Sender<ChanItem>, | |||
refs: Arc<AtomicUsize>, | |||
timer: Timer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
util/fetch/src/client.rs
Outdated
@@ -151,6 +152,7 @@ impl Clone for Client { | |||
Client { | |||
core: self.core.clone(), | |||
refs: self.refs.clone(), | |||
timer: self.timer.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
util/fetch/src/client.rs
Outdated
@@ -193,6 +195,7 @@ impl Client { | |||
Ok(Client { | |||
core: tx_proto, | |||
refs: Arc::new(AtomicUsize::new(1)), | |||
timer: Timer::default(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
util/fetch/src/client.rs
Outdated
Box::new(future) | ||
.and_then(future::result); | ||
|
||
Box::new(self.timer.timeout(future, maxdur)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
util/fetch/src/client.rs
Outdated
@@ -575,6 +570,8 @@ pub enum Error { | |||
Aborted, | |||
/// Too many redirects have been encountered. | |||
TooManyRedirects, | |||
/// tokio-timer gave us an error. | |||
Timer(tokio_timer::TimerError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
util/fetch/src/client.rs
Outdated
tokio_timer::TimeoutError::TimedOut(_) => Error::Timeout, | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good just replace the spaces with tabs!
util/fetch/src/client.rs
Outdated
@@ -750,7 +757,10 @@ mod test { | |||
} | |||
"/delay" => { | |||
let d = Duration::from_secs(req.uri().query().unwrap_or("0").parse().unwrap()); | |||
Box::new(Delay::new(d).from_err().map(|_| Response::new())) | |||
Box::new(self.0.sleep(d) | |||
.map_err(|_| return io::Error::new(io::ErrorKind::Other, "timer error")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/spaces/tab
Yeah I had editorconfig disabled because I was having some issues with magit. I will reformat everything and squash. |
Currently the coverage build fails because `futures-timer` fails to compile with `-C link-dead-code`. This issue has been reported to `futures-timer` (async-rs/futures-timer#2) but has remained unsolved for months. It should be fixed by rustc eventually (rust-lang/rust#45629).
977d045
to
6c25589
Compare
3850a34
to
b464bd1
Compare
Successful coverage build: https://gitlab.parity.io/parity/parity/-/jobs/91344 |
Amazing! |
Better coverage report that doesn't include the |
71ee31d
to
f335830
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* master: fetch: replace futures-timer with tokio-timer (#9066)
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: docs: add changelog for 1.10.9 stable and 1.11.6 beta (openethereum#9069) Enable test in `miner/pool/test` (openethereum#9072) fetch: replace futures-timer with tokio-timer (openethereum#9066) remove util-error (openethereum#9054)
Currently the coverage build fails because
futures-timer
fails to compile with-C link-dead-code
(https://gitlab.parity.io/parity/parity/-/jobs/91245). This issue has been reported tofutures-timer
(async-rs/futures-timer#2) but has remained unsolved for months. It should be fixed by rustc eventually (rust-lang/rust#45629).