-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
Adds debouncing FileSystemWatcher events #129
Adds debouncing FileSystemWatcher events #129
Conversation
…libabries, not the actual connection to the database)
I had to catch SQL timeout exceptions in SqlClientApp in a failing unit test to please the build pipeline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! I appreciate you taking time to write some code. This is definitely something I would like to merge into this library. I just have one question and a comment before I do (see below)
return !string.IsNullOrEmpty(client.ServerVersion); | ||
} | ||
} | ||
catch (SqlException ex) when (ex.Number == -2) // -2 means SQL timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did the SqlException start happening with this change? Was it consistent, or just a flaky test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno, the build pipleline failed: https://github.com/natemcmaster/DotNetCorePlugins/runs/486084609
I'm not sure if it has been a transient error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen it before. This test isn't using reloading though, so it's probably not related to this change.
|
||
namespace McMaster.NETCore.Plugins.Internal | ||
{ | ||
internal class Debouncer : IDisposable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some unit tests for this to verify its behavior (and prevent regressions in the future)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed some unit tests. Do you think they're sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
I've noticed your comment in
PluginLoader
:This PR is my proposal for a fix. It introduces a debouncer component to decouple
FileSystemWatcher
's events. The default delay is 200 msecs, but you can configure it withPluginConfig.ReloadDelay
. If you think another default value is reasonable, feel free to change it.