Skip to content

Fixes reloading files multiple times. Closes #1120 #1140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

waldekmastykarz
Copy link
Collaborator

Fixes reloading files multiple times. Closes #1120

@waldekmastykarz waldekmastykarz added the pr-bugfix Fixes a bug label Apr 22, 2025
@waldekmastykarz waldekmastykarz requested a review from a team as a code owner April 22, 2025 12:18
@garrytrinder garrytrinder requested a review from Copilot April 28, 2025 08:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request addresses the issue of files being reloaded multiple times by implementing a debounce mechanism. Key changes include:

  • Introduction of a debounce timer and corresponding lock to throttle file change events.
  • Removal of redundant FileSystemWatcher event handlers (Created, Deleted, and Renamed).
  • Disposal of the debounce timer in the Dispose method to ensure proper cleanup.
Comments suppressed due to low confidence (2)

dev-proxy-abstractions/BaseLoader.cs:16

  • [nitpick] The type 'Lock' is not a standard locking type; if this is a custom implementation, consider renaming it to better convey its purpose, or evaluate using a standard locking primitive such as an object for clarity.
private readonly Lock _debounceLock = new();

dev-proxy-abstractions/BaseLoader.cs:98

  • Ensure that the removal of event handlers for Created, Deleted, and Renamed is intentional, as omitting these may lead to missed file reloads if such events are required in the future.
_watcher.Created += File_Changed;

@garrytrinder garrytrinder merged commit 60c20ba into dotnet:main Apr 28, 2025
4 checks passed
@waldekmastykarz waldekmastykarz deleted the reload-twice branch April 28, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: After changing mock files, Dev Proxy reloads it twice
2 participants