fix(spaces): add server.running() guards to spawned enforcement tasks
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Failing after 5s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 5s
Update flake hashes / update-flake-hashes (pull_request) Failing after 4s

Check server.running() at the start of each spawned task to avoid
doing enforcement work during shutdown, matching the codebase's
established pattern for short-lived spawned tasks.
This commit is contained in:
ember33 2026-03-19 19:16:04 +01:00
parent 89074c9741
commit 2fbbf76692

View file

@ -834,6 +834,9 @@ impl Service {
) {
let this = Arc::clone(self);
self.server.runtime().spawn(async move {
if !this.server.running() {
return;
}
if event_type != SPACE_CASCADING_EVENT_TYPE
&& !this.is_enabled_for_space(&space_id).await
{
@ -924,6 +927,9 @@ impl Service {
) {
let this = Arc::clone(self);
self.server.runtime().spawn(async move {
if !this.server.running() {
return;
}
if !this.is_enabled_for_space(&space_id).await {
return;
}
@ -1025,6 +1031,9 @@ impl Service {
let this = Arc::clone(self);
self.server.runtime().spawn(async move {
if !this.server.running() {
return;
}
if !this.is_enabled_for_space(&space_id).await {
return;
}