Skip to content

Commit 5bf3ff4

Browse files
chore(launchpad): Remove assembly polling for mobile app + print artifact id if present
1 parent e986daa commit 5bf3ff4

File tree

2 files changed

+14
-64
lines changed

2 files changed

+14
-64
lines changed

src/api/data_types/chunking/mobile_app.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
use serde::{Deserialize, Serialize};
33
use sha1_smol::Digest;
44

5-
use super::ChunkedFileState;
6-
75
#[derive(Debug, Serialize)]
86
pub struct ChunkedMobileAppRequest<'a> {
97
pub checksum: Digest,
@@ -17,7 +15,6 @@ pub struct ChunkedMobileAppRequest<'a> {
1715
#[derive(Debug, Deserialize)]
1816
#[serde(rename_all = "camelCase")]
1917
pub struct AssembleMobileAppResponse {
20-
pub state: ChunkedFileState,
2118
pub missing_chunks: Vec<Digest>,
22-
pub detail: Option<String>,
19+
pub artifact_id: Option<String>,
2320
}

src/commands/mobile_app/upload.rs

Lines changed: 13 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ use clap::{Arg, ArgAction, ArgMatches, Command};
1111
use indicatif::ProgressStyle;
1212
use itertools::Itertools as _;
1313
use log::{debug, info, warn};
14-
use sha1_smol::Digest;
1514
use symbolic::common::ByteView;
1615
use zip::write::SimpleFileOptions;
1716
use zip::{DateTime, ZipWriter};
1817

1918
use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability};
2019
use crate::config::Config;
2120
use crate::utils::args::ArgExt as _;
22-
use crate::utils::chunks::{upload_chunks, Chunk, ASSEMBLE_POLL_INTERVAL};
21+
use crate::utils::chunks::{upload_chunks, Chunk};
2322
use crate::utils::fs::get_sha1_checksums;
2423
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
2524
use crate::utils::fs::TempDir;
@@ -143,8 +142,16 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
143142
sha.as_deref(),
144143
build_configuration,
145144
) {
146-
Ok(_) => {
147-
info!("Successfully uploaded file: {}", path.display());
145+
Ok(artifact_id) => {
146+
if let Some(id) = artifact_id {
147+
info!(
148+
"Successfully uploaded file: {} (artifact_id: {})",
149+
path.display(),
150+
id
151+
);
152+
} else {
153+
info!("Successfully uploaded file: {}", path.display());
154+
}
148155
uploaded_paths.push(path.to_path_buf());
149156
}
150157
Err(e) => {
@@ -344,7 +351,7 @@ fn upload_file(
344351
project: &str,
345352
sha: Option<&str>,
346353
build_configuration: Option<&str>,
347-
) -> Result<()> {
354+
) -> Result<Option<String>> {
348355
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
349356
update to the latest version of Sentry to use the mobile-app upload command.";
350357

@@ -399,61 +406,7 @@ fn upload_file(
399406
} else {
400407
println!("Nothing to upload, all files are on the server");
401408
}
402-
403-
poll_assemble(
404-
api,
405-
checksum,
406-
&checksums,
407-
org,
408-
project,
409-
sha,
410-
build_configuration,
411-
)?;
412-
Ok(())
413-
}
414-
415-
fn poll_assemble(
416-
api: &AuthenticatedApi,
417-
checksum: Digest,
418-
chunks: &[Digest],
419-
org: &str,
420-
project: &str,
421-
sha: Option<&str>,
422-
build_configuration: Option<&str>,
423-
) -> Result<()> {
424-
debug!("Polling assemble for checksum: {}", checksum);
425-
426-
let progress_style = ProgressStyle::default_spinner().template("{spinner} Processing files...");
427-
let pb = ProgressBar::new_spinner();
428-
429-
pb.enable_steady_tick(100);
430-
pb.set_style(progress_style);
431-
432-
let response = loop {
433-
let response =
434-
api.assemble_mobile_app(org, project, checksum, chunks, sha, build_configuration)?;
435-
436-
if response.state.is_finished() {
437-
break response;
438-
}
439-
440-
std::thread::sleep(ASSEMBLE_POLL_INTERVAL);
441-
};
442-
443-
pb.finish_with_duration("Processing");
444-
445-
if response.state.is_err() {
446-
let message = response.detail.as_deref().unwrap_or("unknown error");
447-
bail!("Failed to process uploaded files: {}", message);
448-
}
449-
450-
if response.state.is_pending() {
451-
info!("File upload complete (processing pending on server)");
452-
} else {
453-
info!("File processing complete");
454-
}
455-
456-
Ok(())
409+
Ok(response.artifact_id)
457410
}
458411

459412
#[cfg(not(windows))]

0 commit comments

Comments
 (0)