Async LockManager
MichaelPeter opened this issue · 4 comments
Hi everybody and @ramondeklein
I would need an async lock manager since my locking would happen in a database and be asynchrouns calls.
The question is, now the ILockManager interface wouldn't allow that and I would need to replace the both Lock and Unlock Request handlers, if I would not want to do that I would need to execute all my async calls using LockAsync().Wait().
Think it would be best to make a incompatible fork? Or should I make a pull request for IAsyncLockManager?
I could add a IAsyncLock Manager Interface to the code, but then all Locking code would need a
if(LockManager is IAsyncLockManager)
await ((IAsyncLockManager)LockManager).LockAsync();
else
LockManager.Lock();
but that would make the sourcecode ugly?
I would simply change ILockManager
to async-only. All distributed versions (i.e. using Redis) would require async methods. We can change the current version to make it return a task even though it's actually synchronous.
I know this breaks existing code, but I don't think a lot of people implemented custom locking and if they did, then they should probably have done it async anyway to make it more scalable.
Took me just 8 Months but here is the pull request ;-) #66
Obsolete by #69.