feat: add timer support for legacy::Pool#84
Conversation
src/client/legacy/client.rs
Outdated
| pub fn timer<M>(&mut self, timer: M) -> &mut Self | ||
| where | ||
| M: Timer + Send + Sync + 'static, | ||
| M: Timer + Clone + Send + Sync + 'static, |
There was a problem hiding this comment.
Woops. Adding this would technically be breaking.
I suppose we could just wrap it in the local Timer struct, and pass that? It will mean double Arc-dyn, which is unfortunate. Maybe we can find a clever way to indicate to hyper::rt::Timer that we don't need to double Arc it?
There was a problem hiding this comment.
Whoops yeah you're right, forgot about this one.
For avoiding double Arc-dyn, we can probably come up with something using Deref and or TryFrom, though I feel it's a bit hacky. (something like, if it's from local Timer then don't need to wrap Arc)
I was playing around with unwrap_or_clone just to realize it's still experimental. 😅 https://doc.rust-lang.org/std/sync/struct.Arc.html#method.unwrap_or_clone
bb338ff to
56ccdf7
Compare
Addresses hyperium/hyper#3167
Note that previously we're using tokio's
Intervalrather thanSleep. This PR tries to emulate the behavior forPoolusingSleepinstead, so that:IntervalTimerrather than aTimerand also anInterval.