Skip to content

Commit

Permalink
#2008 Follow-ups (#2009)
Browse files Browse the repository at this point in the history
A few tweaks to the changes #2008 for disposing and normalization.
  • Loading branch information
NickCraver authored Feb 24, 2022
1 parent d59d34e commit 6718fea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/StackExchange.Redis/PhysicalBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public enum State : byte
public void Dispose()
{
isDisposed = true;
_backlogAutoReset?.Dispose();
using (var tmp = physical)
{
physical = null;
Expand Down Expand Up @@ -913,7 +914,7 @@ private async Task ProcessBacklogAsync()
// TODO: vNext handoff this backlog to another primary ("can handle everything") connection
// and remove any per-server commands. This means we need to track a bit of whether something
// was server-endpoint-specific in PrepareToPushMessageToBridge (was the server ref null or not)
await ProcessBridgeBacklogAsync().ConfigureAwait(false); // Needs handoff
await ProcessBridgeBacklogAsync().ForAwait(); // Needs handoff
}
}
catch
Expand Down Expand Up @@ -976,10 +977,10 @@ private async Task ProcessBridgeBacklogAsync()

// try and get the lock; if unsuccessful, retry
#if NETCOREAPP
gotLock = await _singleWriterMutex.WaitAsync(TimeoutMilliseconds).ConfigureAwait(false);
gotLock = await _singleWriterMutex.WaitAsync(TimeoutMilliseconds).ForAwait();
if (gotLock) break; // got the lock; now go do something with it
#else
token = await _singleWriterMutex.TryWaitAsync().ConfigureAwait(false);
token = await _singleWriterMutex.TryWaitAsync().ForAwait();
if (token.Success) break; // got the lock; now go do something with it
#endif
}
Expand Down Expand Up @@ -1021,7 +1022,7 @@ private async Task ProcessBridgeBacklogAsync()
if (result == WriteResult.Success)
{
_backlogStatus = BacklogStatus.Flushing;
result = await physical.FlushAsync(false).ConfigureAwait(false);
result = await physical.FlushAsync(false).ForAwait();
}

_backlogStatus = BacklogStatus.MarkingInactive;
Expand Down

0 comments on commit 6718fea

Please sign in to comment.