Prevent race of upload and progress map update
Ensure that uploadsInProgress are successfully and consistently removed
on completion from the map by adding them prior to beginning an
asynchronous upload.
Fixes
Closes
@@ -238,10 +238,10 @@ class ByteStreamUploader extends AbstractReferenceCounted {
}
},
MoreExecutors.directExecutor());
+ uploadsInProgress.put(digest, uploadResult);
Context ctx = Context.current();
retrier.executeAsync(
() -> ctx.call(() -> startAsyncUpload(chunker, uploadResult)), uploadResult);
- uploadsInProgress.put(digest, uploadResult);
return uploadResult;
}
}
