fix(lib): return an error instead of panic if execute fails
If executing an internal task fails, a new variant of `hyper::Error` is returned to the user, with improved messaging. If a non-critical task fails to spawn, it no longer panics, instead just logging a warning. Closes #1566
This commit is contained in:
@@ -407,12 +407,16 @@ impl<T: Poolable> Connections<T> {
|
||||
|
||||
let start = Instant::now() + dur;
|
||||
|
||||
let interval = Interval::new(start, dur);
|
||||
self.exec.execute(IdleInterval {
|
||||
interval: interval,
|
||||
let interval = IdleInterval {
|
||||
interval: Interval::new(start, dur),
|
||||
pool: WeakOpt::downgrade(pool_ref),
|
||||
pool_drop_notifier: rx,
|
||||
});
|
||||
};
|
||||
|
||||
if let Err(err) = self.exec.execute(interval) {
|
||||
// This task isn't critical, so simply log and ignore.
|
||||
warn!("error spawning connection pool idle interval: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user