mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
[ty] Cancel background tasks when shutdown is requested (#20039)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
This commit is contained in:
parent
7a44ea680e
commit
c5e05df966
2 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,7 @@ use crate::server::api::traits::{RequestHandler, SyncRequestHandler};
|
||||||
use crate::session::client::Client;
|
use crate::session::client::Client;
|
||||||
|
|
||||||
use lsp_types::{WorkspaceDiagnosticReport, WorkspaceDiagnosticReportResult};
|
use lsp_types::{WorkspaceDiagnosticReport, WorkspaceDiagnosticReportResult};
|
||||||
|
use salsa::Database;
|
||||||
|
|
||||||
pub(crate) struct ShutdownHandler;
|
pub(crate) struct ShutdownHandler;
|
||||||
|
|
||||||
|
@ -28,6 +29,12 @@ impl SyncRequestHandler for ShutdownHandler {
|
||||||
|
|
||||||
session.set_shutdown_requested(true);
|
session.set_shutdown_requested(true);
|
||||||
|
|
||||||
|
// Trigger cancellation for every db to cancel any compute intensive background tasks
|
||||||
|
// (e.g. workspace diagnostics or workspace symbols).
|
||||||
|
for db in session.projects_mut() {
|
||||||
|
db.trigger_cancellation();
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ impl Session {
|
||||||
/// Returns a mutable iterator over all project databases that have been initialized to this point.
|
/// Returns a mutable iterator over all project databases that have been initialized to this point.
|
||||||
///
|
///
|
||||||
/// This iterator will only yield the default project database if it has been used.
|
/// This iterator will only yield the default project database if it has been used.
|
||||||
fn projects_mut(&mut self) -> impl Iterator<Item = &'_ mut ProjectDatabase> + '_ {
|
pub(crate) fn projects_mut(&mut self) -> impl Iterator<Item = &'_ mut ProjectDatabase> + '_ {
|
||||||
self.project_states_mut().map(|project| &mut project.db)
|
self.project_states_mut().map(|project| &mut project.db)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue