Skip to content

Commit bddcd5f

Browse files
committed
refactoring
1 parent 63f1a18 commit bddcd5f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedManagement/PartitionControllerCore.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ public override async Task AddOrUpdateLeaseAsync(DocumentServiceLease lease)
8989
throw;
9090
}
9191

92-
PartitionSupervisor supervisor = this.partitionSupervisorFactory.Create(lease);
93-
this.ProcessPartitionAsync(supervisor, lease).LogException();
92+
this.ProcessPartitionAsync(lease).LogException();
9493
}
9594

9695
public override async Task ShutdownAsync()
@@ -146,8 +145,10 @@ private async Task RemoveLeaseAsync(DocumentServiceLease lease, bool wasAcquired
146145
}
147146
}
148147

149-
private async Task ProcessPartitionAsync(PartitionSupervisor partitionSupervisor, DocumentServiceLease lease)
148+
private async Task ProcessPartitionAsync(DocumentServiceLease lease)
150149
{
150+
using PartitionSupervisor partitionSupervisor = this.partitionSupervisorFactory.Create(lease);
151+
151152
try
152153
{
153154
await partitionSupervisor.RunAsync(this.shutdownCts.Token).ConfigureAwait(false);
@@ -167,8 +168,6 @@ private async Task ProcessPartitionAsync(PartitionSupervisor partitionSupervisor
167168
}
168169

169170
await this.RemoveLeaseAsync(lease: lease, wasAcquired: true).ConfigureAwait(false);
170-
171-
partitionSupervisor.Dispose();
172171
}
173172

174173
private async Task HandlePartitionGoneAsync(DocumentServiceLease lease, string lastContinuationToken)

0 commit comments

Comments
 (0)