worker: remove some unwraps
This commit is contained in:
parent
bd01de758f
commit
ba4eb9cf37
|
@ -40,7 +40,7 @@ async fn main() {
|
|||
let next_task = if workers_active < config.max_workers {
|
||||
world.dequeue()
|
||||
} else {
|
||||
Err(Duration::from_secs(3600))
|
||||
Err(Duration::from_secs(5))
|
||||
};
|
||||
match next_task {
|
||||
Err(duration) => {
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn fetch_and_process(
|
|||
timestamps.sort();
|
||||
let next_interval = if timestamps.len() > 1 {
|
||||
((*timestamps.last().unwrap() - timestamps[0]) / (timestamps.len() as i32)
|
||||
).to_std().unwrap()
|
||||
).to_std().unwrap_or(DEFAULT_INTERVAL)
|
||||
.min(DEFAULT_INTERVAL)
|
||||
.max(MIN_INTERVAL)
|
||||
} else {
|
||||
|
@ -54,8 +54,8 @@ pub fn fetch_and_process(
|
|||
}
|
||||
}
|
||||
let hosts = hosts.into_iter().collect();
|
||||
tx.send(Message::IntroduceHosts { hosts }).unwrap();
|
||||
tx.send(Message::Posts { posts }).unwrap();
|
||||
let _ = tx.send(Message::IntroduceHosts { hosts });
|
||||
let _ = tx.send(Message::Posts { posts });
|
||||
|
||||
tx.send(Message::Fetched {
|
||||
host: host.clone(),
|
||||
|
|
Loading…
Reference in New Issue