Skip to content

Commit

Permalink
only filter chunks in assemble_artifact_bundle case
Browse files Browse the repository at this point in the history
  • Loading branch information
loewenheim committed Jun 22, 2023
1 parent ee57468 commit f0bab45
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions src/utils/file_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,30 +379,25 @@ fn upload_files_chunked(
style(">").dim(),
));

let missing_chunks = {
// Filter out chunks that are already on the server. This only matters if we're in the
// `assemble_artifact_bundle` case; `assemble_release_artifacts` always returns `missing_chunks: []`,
// so there's no point querying the endpoint.
if options.supports(ChunkUploadCapability::ArtifactBundles) && context.project.is_some() {
let api = Api::current();
let response = if options.supports(ChunkUploadCapability::ArtifactBundles)
&& context.project.is_some()
{
api.assemble_artifact_bundle(
context.org,
vec![context.project.unwrap().to_string()],
checksum,
&checksums,
context.release,
context.dist,
)?
} else {
api.assemble_release_artifacts(context.org, context.release()?, checksum, &checksums)?
};

response.missing_chunks
let response = api.assemble_artifact_bundle(
context.org,
vec![context.project.unwrap().to_string()],
checksum,
&checksums,
context.release,
context.dist,
)?;
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));
};

chunks.retain(|Chunk((digest, _))| missing_chunks.contains(digest));
upload_chunks(&chunks, options, progress_style)?;

if !missing_chunks.is_empty() {
if !chunks.is_empty() {
println!("{} Uploaded files to Sentry", style(">").dim());
poll_assemble(checksum, &checksums, context, options)
} else {
Expand Down

0 comments on commit f0bab45

Please sign in to comment.