Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ealsur committed Dec 19, 2023
1 parent 63f1a18 commit bddcd5f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public override async Task AddOrUpdateLeaseAsync(DocumentServiceLease lease)
throw;
}

PartitionSupervisor supervisor = this.partitionSupervisorFactory.Create(lease);
this.ProcessPartitionAsync(supervisor, lease).LogException();
this.ProcessPartitionAsync(lease).LogException();
}

public override async Task ShutdownAsync()
Expand Down Expand Up @@ -146,8 +145,10 @@ private async Task RemoveLeaseAsync(DocumentServiceLease lease, bool wasAcquired
}
}

private async Task ProcessPartitionAsync(PartitionSupervisor partitionSupervisor, DocumentServiceLease lease)
private async Task ProcessPartitionAsync(DocumentServiceLease lease)
{
using PartitionSupervisor partitionSupervisor = this.partitionSupervisorFactory.Create(lease);

try
{
await partitionSupervisor.RunAsync(this.shutdownCts.Token).ConfigureAwait(false);
Expand All @@ -167,8 +168,6 @@ private async Task ProcessPartitionAsync(PartitionSupervisor partitionSupervisor
}

await this.RemoveLeaseAsync(lease: lease, wasAcquired: true).ConfigureAwait(false);

partitionSupervisor.Dispose();
}

private async Task HandlePartitionGoneAsync(DocumentServiceLease lease, string lastContinuationToken)
Expand Down

0 comments on commit bddcd5f

Please sign in to comment.