Skip to content

perf: cancel in-flight worker requests#914

Merged
adalinesimonian merged 1 commit into
mainfrom
worker-request-cancellation
Apr 11, 2026
Merged

perf: cancel in-flight worker requests#914
adalinesimonian merged 1 commit into
mainfrom
worker-request-cancellation

Conversation

@adalinesimonian

Copy link
Copy Markdown
Member

Cancel in-flight worker requests that have become obsolete.

When a new validation is triggered for a document, via re-edit, config change, watched file change, or otherwise, any previous worker request for that document was left to run to completion in the worker process, even though its results would be discarded. With rapid edits or bulk operations, multiple stale requests could pile up, wasting CPU time in the worker and delaying the result the user actually cares about.

This adds an AbortController-based cancellation system that propagates from the validator service through the runner and workspace service, across IPC into the worker process. When a validation becomes obsolete, the in-flight request is aborted immediately, freeing the worker to handle the current request sooner.

@adalinesimonian adalinesimonian requested a review from a team April 10, 2026 07:27
@adalinesimonian adalinesimonian self-assigned this Apr 10, 2026
@changeset-bot

changeset-bot Bot commented Apr 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 424a4aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@stylelint/language-server Patch
@stylelint/vscode-stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jeddy3 jeddy3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution to the problem!

LGTM, thank you.

@adalinesimonian adalinesimonian merged commit 4a5c076 into main Apr 11, 2026
17 checks passed
@adalinesimonian adalinesimonian deleted the worker-request-cancellation branch April 11, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants