Skip to content

Commit fce0bba

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

File tree

2 files changed

+14
-59
lines changed

2 files changed

+14
-59
lines changed

src/api/data_types/chunking/mobile_app.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ pub struct AssembleMobileAppResponse {
2020
pub state: ChunkedFileState,
2121
pub missing_chunks: Vec<Digest>,
2222
pub detail: Option<String>,
23+
pub artifact_id: Option<String>,
2324
}

src/commands/mobile_app/upload.rs

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use zip::{DateTime, ZipWriter};
1919
use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability};
2020
use crate::config::Config;
2121
use crate::utils::args::ArgExt as _;
22-
use crate::utils::chunks::{upload_chunks, Chunk, ASSEMBLE_POLL_INTERVAL};
22+
use crate::utils::chunks::{upload_chunks, Chunk};
2323
use crate::utils::fs::get_sha1_checksums;
2424
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
2525
use crate::utils::fs::TempDir;
@@ -143,8 +143,16 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
143143
sha.as_deref(),
144144
build_configuration,
145145
) {
146-
Ok(_) => {
147-
info!("Successfully uploaded file: {}", path.display());
146+
Ok(artifact_id) => {
147+
if let Some(id) = artifact_id {
148+
info!(
149+
"Successfully uploaded file: {} (artifact_id: {})",
150+
path.display(),
151+
id
152+
);
153+
} else {
154+
info!("Successfully uploaded file: {}", path.display());
155+
}
148156
uploaded_paths.push(path.to_path_buf());
149157
}
150158
Err(e) => {
@@ -344,7 +352,7 @@ fn upload_file(
344352
project: &str,
345353
sha: Option<&str>,
346354
build_configuration: Option<&str>,
347-
) -> Result<()> {
355+
) -> Result<Option<String>> {
348356
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
349357
update to the latest version of Sentry to use the mobile-app upload command.";
350358

@@ -399,61 +407,7 @@ fn upload_file(
399407
} else {
400408
println!("Nothing to upload, all files are on the server");
401409
}
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(())
410+
Ok(response.artifact_id)
457411
}
458412

459413
#[cfg(not(windows))]

0 commit comments

Comments
 (0)