Skip to content

Commit

Permalink
Fixed named convention
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jun 14, 2024
1 parent e8b0bd6 commit 07aa788
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/DotNext.Threading/Threading/Leases/LeaseConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private TimeSpan AdjustTimeToLive(TimeSpan originalTtl)
/// <see cref="TryAcquireAsync(CancellationToken)"/> or <see cref="TryRenewAsync(CancellationToken)"/>
/// should not be used after. The typical use case to invoke these methods and then obtain the token.
/// </remarks>
public CancellationToken Token => source?.Token ?? new(true);
public CancellationToken Token => source?.Token ?? new(canceled: true);

private void CancelAndDispose()
{
Expand Down Expand Up @@ -109,7 +109,7 @@ public async ValueTask<bool> TryRenewAsync(CancellationToken token = default)

var ts = new Timestamp();
TimeSpan remainingTime;
if (await TryRenewAsync(identity, token).ConfigureAwait(false) is { } response && (remainingTime = AdjustTimeToLive(response.TimeToLive - ts.Elapsed)) > TimeSpan.Zero)
if (await TryRenewCoreAsync(identity, token).ConfigureAwait(false) is { } response && (remainingTime = AdjustTimeToLive(response.TimeToLive - ts.Elapsed)) > TimeSpan.Zero)
{
identity = response.Identity;

Expand Down Expand Up @@ -140,7 +140,7 @@ static bool TryResetOrDestroy(CancellationTokenSource source)
/// <param name="token">The token that can be used to cancel the operation.</param>
/// <returns>The response from the lease provider; or <see langword="null"/> if the lease cannot be taken.</returns>
/// <exception cref="OperationCanceledException">The operation has been canceled.</exception>
protected abstract ValueTask<AcquisitionResult?> TryRenewAsync(LeaseIdentity identity, CancellationToken token);
protected abstract ValueTask<AcquisitionResult?> TryRenewCoreAsync(LeaseIdentity identity, CancellationToken token);

/// <summary>
/// Releases a lease.
Expand All @@ -162,7 +162,7 @@ public async ValueTask<bool> ReleaseAsync(CancellationToken token = default)
throw new InvalidOperationException();

CancelAndDispose();
if (await ReleaseAsync(this.identity, token).ConfigureAwait(false) is { } identity)
if (await ReleaseCoreAsync(this.identity, token).ConfigureAwait(false) is { } identity)
{
this.identity = identity;
return true;
Expand All @@ -179,7 +179,7 @@ public async ValueTask<bool> ReleaseAsync(CancellationToken token = default)
/// <param name="token">The token that can be used to cancel the operation.</param>
/// <returns>The response from the lease provider; or <see langword="null"/> if the lease cannot be taken.</returns>
/// <exception cref="OperationCanceledException">The operation has been canceled.</exception>
protected abstract ValueTask<LeaseIdentity?> ReleaseAsync(LeaseIdentity identity, CancellationToken token);
protected abstract ValueTask<LeaseIdentity?> ReleaseCoreAsync(LeaseIdentity identity, CancellationToken token);

/// <inheritdoc/>
protected override void Dispose(bool disposing)
Expand Down

0 comments on commit 07aa788

Please sign in to comment.