-
Notifications
You must be signed in to change notification settings - Fork 44
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
Refactor distributed lock, such that they work with async code #41
Conversation
Thank you, I'll try to check and merge your PR tomorrow. |
Thanks, seems to work well (not reproduced the sync issue from #31) |
Looks like after these changes on version 1.8 encountering test failures when run in parallel. Everything works in the previous version, 1.7.0. |
Seems that you try to execute same named job in the same time. First is not finished and second request is in timeout. |
Right. I'm using WebApplicationFactory for tests. In Strartup each instance adds a background job. Probably it's because Data are stored in a static way |
yes it uses static variables to store a lot of internal state.. So no separation between different instances.. I tried to make them independent while fixing this synchronization issue, but it would have introduced too many changes / i wasn´t sure if this breaks something else.. The Furthemore Hangfire itself uses static classes / advertises the use of static class methods to submit jobs.. I did it now and created a PR: |
Built a package based on your PR, still encountering the same issue.
Most likely it's the case |
Monitor
toSemaphoreSlim
which works in async contexts, where the lock is acquired by one thread and released by anotherMemoryStorageConnection
class to avoid spreading state over multiple typesDisposable
Utillity class to have a quickhand for returning disposables