Skip to content

Warden: Don't spawn new threads when canceling#182

Open
sol wants to merge 1 commit into
simonmar:masterfrom
sol:use-cancelMany
Open

Warden: Don't spawn new threads when canceling#182
sol wants to merge 1 commit into
simonmar:masterfrom
sol:use-cancelMany

Conversation

@sol
Copy link
Copy Markdown

@sol sol commented May 19, 2026

This now:

  • throws AsyncCancelled to each remaining job (from the current thread, without spawning any new threads)
  • waits for each job to terminate

@simonmar from what I understand, the existing code spawns a new thread for each remaining job in the cancel queue. I'm not claiming that this is necessarily a big problem or even observable in many situations, I didn't run anything, this is purely from reading the code. BUT: The existing code also requires you to read much more code if you wanna understand what exactly is happening.

So unless I'm missing some nuance here, the new code should be both:

  • more resource efficient
  • easier to understand

@sol sol changed the title Warden: Don't spawn new threads when canceling Warden: Don't spawn new threads when cancelling May 19, 2026
@sol sol changed the title Warden: Don't spawn new threads when cancelling Warden: Don't spawn new threads when canceling May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant