From 0f5e4c7f8db637c028438131dc4349210026c50f Mon Sep 17 00:00:00 2001 From: ftbsc Date: Wed, 12 Apr 2023 16:58:00 +0200 Subject: [PATCH] chore: small style tweaks --- src/server/buffer/actor.rs | 8 ++++---- src/server/buffer/service.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/buffer/actor.rs b/src/server/buffer/actor.rs index f65e5f6..05046f9 100644 --- a/src/server/buffer/actor.rs +++ b/src/server/buffer/actor.rs @@ -73,16 +73,16 @@ impl BufferWorker { Some(v) => match serde_json::from_str::(&v.opseq) { Err(e) => break error!("could not deserialize opseq: {}", e), Ok(op) => match op.apply(&self.store) { - Err(e) => error!("coult not apply OpSeq '{:?}' on '{}' : {}", v, self.store, e), + Err(e) => error!("coult not apply OpSeq '{:?}' on '{}' : {}", v, self.store, e), // TODO Ok(res) => { self.store = res; let msg = RawOp { opseq: v.opseq, user: v.user }; - if let Err(e) = self.digest.send(md5::compute(&self.store)) { - error!("could not update digest: {}", e); - } + // if let Err(e) = self.digest.send(md5::compute(&self.store)) { + // error!("could not update digest: {}", e); + // } if let Err(e) = self.content.send(self.store.clone()) { error!("could not update content: {}", e); } diff --git a/src/server/buffer/service.rs b/src/server/buffer/service.rs index 141e96e..87e20fd 100644 --- a/src/server/buffer/service.rs +++ b/src/server/buffer/service.rs @@ -52,10 +52,11 @@ impl Buffer for BufferService { type AttachStream = OperationStream; type ListenStream = CursorStream; - async fn attach(&self, req: Request) -> Result, Status> { + async fn attach(&self, req: Request) -> Result, Status> { let request = req.into_inner(); let myself = request.user; match self.map.read().unwrap().get(&request.path) { + None => Err(Status::not_found("path not found")), Some(handle) => { let (tx, rx) = mpsc::channel(128); let mut sub = handle.subscribe(); @@ -74,11 +75,10 @@ impl Buffer for BufferService { info!("registered new subscriber on buffer"); Ok(Response::new(Box::pin(output_stream))) }, - None => Err(Status::not_found("path not found")), } } - async fn listen(&self, req: Request) -> Result, Status> { + async fn listen(&self, req: Request) -> Result, Status> { let mut sub = self.cursor.subscribe(); let myself = req.into_inner().user; let (tx, rx) = mpsc::channel(128);