mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Sync handlers cannot be cancelled
This commit is contained in:
parent
e2da967578
commit
d88ae66ed9
3 changed files with 9 additions and 19 deletions
|
@ -51,10 +51,9 @@ impl<'a> RequestDispatcher<'a> {
|
|||
let _pctx = stdx::panic_context::enter(panic_context);
|
||||
f(self.global_state, params)
|
||||
};
|
||||
match result_to_response::<R>(req.id.clone(), result) {
|
||||
Ok(response) => self.global_state.respond(response),
|
||||
Err(_) => self.global_state.task_pool.handle.send_retry(req),
|
||||
};
|
||||
if let Ok(response) = result_to_response::<R>(req.id.clone(), result) {
|
||||
self.global_state.respond(response);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
@ -80,10 +79,9 @@ impl<'a> RequestDispatcher<'a> {
|
|||
f(global_state_snapshot, params)
|
||||
});
|
||||
|
||||
match thread_result_to_response::<R>(req.id.clone(), result) {
|
||||
Ok(response) => self.global_state.respond(response),
|
||||
Err(_) => self.global_state.task_pool.handle.send_retry(req),
|
||||
};
|
||||
if let Ok(response) = thread_result_to_response::<R>(req.id.clone(), result) {
|
||||
self.global_state.respond(response);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
|
|
@ -173,13 +173,13 @@ impl GlobalState {
|
|||
msg.ok().map(Event::Lsp),
|
||||
|
||||
recv(self.task_pool.receiver) -> task =>
|
||||
task.ok().map(Event::Task),
|
||||
Some(Event::Task(task.unwrap())),
|
||||
|
||||
recv(self.loader.receiver) -> task =>
|
||||
task.ok().map(Event::Vfs),
|
||||
Some(Event::Vfs(task.unwrap())),
|
||||
|
||||
recv(self.flycheck_receiver) -> task =>
|
||||
task.ok().map(Event::Flycheck),
|
||||
Some(Event::Flycheck(task.unwrap())),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//! properly.
|
||||
use crossbeam_channel::Sender;
|
||||
|
||||
use crate::main_loop::Task;
|
||||
|
||||
pub(crate) struct TaskPool<T> {
|
||||
sender: Sender<T>,
|
||||
inner: threadpool::ThreadPool,
|
||||
|
@ -46,9 +44,3 @@ impl<T> Drop for TaskPool<T> {
|
|||
self.inner.join()
|
||||
}
|
||||
}
|
||||
|
||||
impl TaskPool<Task> {
|
||||
pub(crate) fn send_retry(&self, req: lsp_server::Request) {
|
||||
let _ = self.sender.send(Task::Retry(req));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue