mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-25 00:44:48 +01:00
chore: better logging of workers stopping
This commit is contained in:
parent
ebf25fee44
commit
6fe92b9e8e
2 changed files with 12 additions and 7 deletions
|
@ -147,7 +147,7 @@ impl Handler for NeovimHandler {
|
|||
Ok(()) => {
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
if !_controller.run() { break }
|
||||
if !_controller.run() { break debug!("buffer updater clean exit") }
|
||||
let _span = _controller.wait().await;
|
||||
// TODO only change lines affected!
|
||||
let lines : Vec<String> = _controller.content().split("\n").map(|x| x.to_string()).collect();
|
||||
|
@ -199,9 +199,9 @@ impl Handler for NeovimHandler {
|
|||
debug!("spawning cursor processing worker");
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
if !controller.run() { break }
|
||||
if !controller.run() { break debug!("cursor worker clean exit") }
|
||||
match sub.recv().await {
|
||||
Err(e) => return error!("error receiving cursor update from controller: {}", e),
|
||||
Err(e) => break error!("error receiving cursor update from controller: {}", e),
|
||||
Ok((_usr, cur)) => {
|
||||
if let Err(e) = buf.clear_namespace(ns, 0, -1).await {
|
||||
error!("could not clear previous cursor highlight: {}", e);
|
||||
|
@ -212,6 +212,9 @@ impl Handler for NeovimHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
if let Err(e) = buf.clear_namespace(ns, 0, -1).await {
|
||||
error!("could not clear previous cursor highlight: {}", e);
|
||||
}
|
||||
});
|
||||
Ok(Value::Nil)
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::sync::Arc;
|
|||
|
||||
use operational_transform::OperationSeq;
|
||||
use tonic::{transport::Channel, Status};
|
||||
use tracing::{error, warn, info};
|
||||
use tracing::{error, warn, debug};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
|
@ -51,7 +51,7 @@ impl CodempClient {
|
|||
loop {
|
||||
match stream.message().await {
|
||||
Err(e) => break error!("error receiving cursor: {}", e),
|
||||
Ok(None) => break,
|
||||
Ok(None) => break debug!("cursor worker clean exit"),
|
||||
Ok(Some(x)) => { _controller.update(x); },
|
||||
}
|
||||
}
|
||||
|
@ -77,12 +77,13 @@ impl CodempClient {
|
|||
let factory = Arc::new(OperationController::new(content.unwrap_or("".into())));
|
||||
|
||||
let _factory = factory.clone();
|
||||
let _path = path.clone();
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
if !_factory.run() { break }
|
||||
if !_factory.run() { break debug!("downstream worker clean exit") }
|
||||
match stream.message().await {
|
||||
Err(e) => break error!("error receiving update: {}", e),
|
||||
Ok(None) => break, // clean exit
|
||||
Ok(None) => break warn!("stream closed for buffer {}", _path),
|
||||
Ok(Some(x)) => match serde_json::from_str::<OperationSeq>(&x.opseq) {
|
||||
Err(e) => error!("error deserializing opseq: {}", e),
|
||||
Ok(v) => match _factory.process(v).await {
|
||||
|
@ -118,6 +119,7 @@ impl CodempClient {
|
|||
Err(e) => error!("could not send edit: {}", e),
|
||||
}
|
||||
}
|
||||
debug!("upstream worker clean exit");
|
||||
});
|
||||
|
||||
Ok(factory)
|
||||
|
|
Loading…
Reference in a new issue