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 |
MonitortoSemaphoreSlimwhich works in async contexts, where the lock is acquired by one thread and released by anotherMemoryStorageConnectionclass to avoid spreading state over multiple typesDisposableUtillity class to have a quickhand for returning disposables