Skip to content

Commit

Permalink
Update Remove to TryRemove for ConcurrentDictionary in Transfermanager (
Browse files Browse the repository at this point in the history
  • Loading branch information
amnguye authored Nov 8, 2024
1 parent af5ccc6 commit 8a63175
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ await _checkpointer.AddNewJobAsync(
// cleanup any state for a job that didn't even start
try
{
_dataTransfers.Remove(transferId);
// No need to check if we were able to remove the transfer or not.
// If there's no stale DataTransfer to remove, move on, because this is a cleanup
_dataTransfers.TryRemove(transferId, out DataTransfer transfer);
await _checkpointer.TryRemoveStoredTransferAsync(transferId, cancellationToken).ConfigureAwait(false);
}
catch (Exception cleanupEx)
Expand Down

0 comments on commit 8a63175

Please sign in to comment.