update dependencies

This commit is contained in:
dignifiedquire
2020-05-23 00:17:50 +02:00
parent 8569e1c18b
commit 05f79c1c01
5 changed files with 170 additions and 169 deletions

View File

@@ -1,8 +1,7 @@
//! # Events specification
use async_std::path::PathBuf;
use crossbeam_channel::{bounded as channel, Receiver, Sender, TrySendError};
use async_std::sync::{channel, Receiver, Sender, TrySendError};
use strum::EnumProperty;
use crate::chat::ChatId;
@@ -51,13 +50,13 @@ pub struct EventEmitter(Receiver<Event>);
impl EventEmitter {
/// Blocking recv of an event. Return `None` if the `Sender` has been droped.
pub fn recv_sync(&self) -> Option<Event> {
self.0.recv().ok()
async_std::task::block_on(self.recv())
}
/// Blocking async recv of an event. Return `None` if the `Sender` has been droped.
pub async fn recv(&self) -> Option<Event> {
// TODO: change once we can use async channels internally.
self.0.recv().ok()
self.0.recv().await.ok()
}
}

View File

@@ -13,6 +13,7 @@ pub(crate) struct StopToken;
/// Job and connection scheduler.
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub(crate) enum Scheduler {
Stopped,
Running {
@@ -339,12 +340,15 @@ impl Scheduler {
}
// wait for all loops to be started
inbox_start_recv
if let Err(err) = inbox_start_recv
.recv()
.join(mvbox_start_recv.recv())
.join(sentbox_start_recv.recv())
.join(smtp_start_recv.recv())
.await;
.try_join(mvbox_start_recv.recv())
.try_join(sentbox_start_recv.recv())
.try_join(smtp_start_recv.recv())
.await
{
error!(ctx, "failed to start scheduler: {}", err);
}
info!(ctx, "scheduler is running");
}
@@ -478,7 +482,7 @@ impl ConnectionState {
// Trigger shutdown of the run loop.
self.stop_sender.send(()).await;
// Wait for a notification that the run loop has been shutdown.
self.shutdown_receiver.recv().await;
self.shutdown_receiver.recv().await.ok();
}
async fn interrupt(&self) {