fix: missing await, debug on ignorableErr, content

This commit is contained in:
əlemi 2023-11-24 10:43:37 +01:00
parent 0bd8f0541d
commit 488c22c0f1
4 changed files with 4 additions and 6 deletions

View file

@ -74,7 +74,7 @@ impl Controller<TextChange> for BufferController {
async fn poll(&self) -> crate::Result<()> { async fn poll(&self) -> crate::Result<()> {
let (tx, rx) = oneshot::channel::<()>(); let (tx, rx) = oneshot::channel::<()>();
self.poller.send(tx); self.poller.send(tx).await?;
Ok(rx.await.map_err(|_| crate::Error::Channel { send: false })?) Ok(rx.await.map_err(|_| crate::Error::Channel { send: false })?)
} }

View file

@ -136,7 +136,7 @@ impl ControllerWorker<TextChange> for BufferControllerWorker {
match self.send_op(&mut tx, &op).await { match self.send_op(&mut tx, &op).await {
Err(e) => tracing::error!("server refused to broadcast {}: {}", op, e), Err(e) => tracing::error!("server refused to broadcast {}: {}", op, e),
Ok(()) => { Ok(()) => {
// self.content.send(self.buffer.view()).unwrap_or_warn("could not send buffer update"); self.content.send(self.buffer.view()).unwrap_or_warn("could not send buffer update");
}, },
} }
} }
@ -161,7 +161,6 @@ impl ControllerWorker<TextChange> for BufferControllerWorker {
}, },
}, },
} }
} }
} }
} }

View file

@ -5,7 +5,6 @@
use std::{sync::Arc, collections::BTreeMap}; use std::{sync::Arc, collections::BTreeMap};
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tokio_stream::StreamExt;
use tonic::transport::Channel; use tonic::transport::Channel;
use crate::{ use crate::{

View file

@ -12,11 +12,11 @@ pub trait IgnorableError {
} }
impl<T, E> IgnorableError for StdResult<T, E> impl<T, E> IgnorableError for StdResult<T, E>
where E : std::fmt::Display { where E : std::fmt::Debug {
fn unwrap_or_warn(self, msg: &str) { fn unwrap_or_warn(self, msg: &str) {
match self { match self {
Ok(_) => {}, Ok(_) => {},
Err(e) => warn!("{}: {}", msg, e), Err(e) => warn!("{}: {:?}", msg, e),
} }
} }
} }