configcat / .net-sdk

ConfigCat SDK for .NET. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
https://configcat.com/docs/sdk-reference/csharp
Other
29 stars 8 forks source link

Handle files locked by another process #33

Closed z4kn4fein closed 2 years ago

z4kn4fein commented 2 years ago

Describe the purpose of your pull request

In this PR I fixed a file locking issue with FileSystemWatcher. The watcher doesn't really care about whether the write is finished or not on a file that is changed, so our current reload function could easily fail on trying to open a locked file. A lock-check loop was introduced to give the reload functionality more chance to open the file if it's being unlocked within 10s of trying.

I also made some consolidation around the LogLevel, it was kinda confusing as it was defined on both the LoggerWrapper and ConsoleLogger at the same time but it was just used on the LoggerWrapper really. Now the wrapper is only proxying the underlying ILogger's LogLevel.

Requirement checklist (only if applicable)

sonarcloud[bot] commented 2 years ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

77.1% 77.1% Coverage
0.0% 0.0% Duplication