Skip to content

Refactor: upgrade configWatcher.ts disposal pattern#703

Merged
edvilme merged 2 commits intomainfrom
phase4/configwatcher-disposal
Apr 9, 2026
Merged

Refactor: upgrade configWatcher.ts disposal pattern#703
edvilme merged 2 commits intomainfrom
phase4/configwatcher-disposal

Conversation

@edvilme
Copy link
Copy Markdown
Contributor

@edvilme edvilme commented Apr 8, 2026

Adopts the enhanced disposal pattern from pylint's configWatcher.ts:

  • Adds disposed flag to prevent event handlers from running after disposal
  • Tracks pending promise to cancel in-flight config change operations
  • Adds traceError for proper error handling in event callbacks

This prevents potential race conditions when the extension deactivates while config file change handlers are still executing.

Part of #697
Ref: microsoft/vscode-python-tools-extension-template#290

@edvilme edvilme added the debt Technical debt or repo cleanup label Apr 8, 2026
@edvilme edvilme requested a review from rchiodo April 8, 2026 20:02
rchiodo
rchiodo previously approved these changes Apr 8, 2026
Copy link
Copy Markdown

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

Approved via Review Center.

Adopt enhanced disposal pattern from pylint with:
- disposed flag to prevent handlers running after disposal
- pending promise tracking to cancel in-flight operations
- traceError for error handling in event callbacks

This prevents race conditions when the extension deactivates while
config change handlers are still executing.

Part of #697
Ref: microsoft/vscode-python-tools-extension-template#290

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@edvilme edvilme force-pushed the phase4/configwatcher-disposal branch from a14dcb4 to dee9409 Compare April 9, 2026 01:16
@edvilme edvilme requested a review from rchiodo April 9, 2026 01:18
Copy link
Copy Markdown

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

Approved via Review Center.

@edvilme edvilme merged commit f7f009e into main Apr 9, 2026
21 checks passed
@edvilme edvilme deleted the phase4/configwatcher-disposal branch April 9, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Technical debt or repo cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants