You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The most natural way to expose this is through the returned handle:
SqlDistributedLock myLock = ...
using (var handle = await myLock.AcquireAsync())
{
handle.GetConnectionBrokenToken().Register(() => Console.WriteLine("oh no, the connection died!");
}
This can be implemented using a cancelable WAITFOR under the hood which should hopefully fail if the SPID dies. It will need to be merged with keepalive in cases where we do that.
Potentially this could be a function on all LockHandles, not just SQL. Some would return CancellationToken.None or throw `NotSupportedException, potentially.
However, this would be a breaking API change (right now handles are simply IDisposable), so this should be left for V2.
The text was updated successfully, but these errors were encountered:
There is some discussion of this idea here: #5
The most natural way to expose this is through the returned handle:
This can be implemented using a cancelable WAITFOR under the hood which should hopefully fail if the SPID dies. It will need to be merged with keepalive in cases where we do that.
Potentially this could be a function on all
LockHandle
s, not just SQL. Some would returnCancellationToken.None
or throw `NotSupportedException, potentially.However, this would be a breaking API change (right now handles are simply
IDisposable
), so this should be left for V2.The text was updated successfully, but these errors were encountered: