A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/madelson/DistributedLock/issues/6 below:

Add mechanism for tracking when a lock's underlying connection dies · Issue #6 · madelson/DistributedLock · GitHub

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4