Skip to content
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

Add mechanism for tracking when a lock's underlying connection dies #6

Closed
madelson opened this issue Mar 12, 2017 · 0 comments
Closed
Milestone

Comments

@madelson
Copy link
Owner

madelson commented Mar 12, 2017

There is some discussion of this idea here: #5

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant