diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 11:07:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 11:15:29 +0900 |
| commit | 9f0d210021c54f63c9984446862b6ec68834bc63 (patch) | |
| tree | d1522b8047c60bc7ee7a9d832178dd24e1b07636 /crates/mozart/src/commands/update.rs | |
| parent | 2c243a3cb814939bbe40fda1608781825ab0d77d (diff) | |
| download | php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.tar.gz php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.tar.zst php-mozart-9f0d210021c54f63c9984446862b6ec68834bc63.zip | |
refactor(async): migrate from blocking HTTP to async/await with tokio
Replace reqwest::blocking with async reqwest across the entire codebase.
All command execute functions, registry API calls (packagist, downloader,
resolver, lockfile), and the main entry point now use async/await with
the tokio runtime. The pubgrub resolver runs on spawn_blocking since its
DependencyProvider trait is synchronous, using Handle::block_on for
async I/O within that context.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/update.rs')
| -rw-r--r-- | crates/mozart/src/commands/update.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs index 3a7c423..53ee9d7 100644 --- a/crates/mozart/src/commands/update.rs +++ b/crates/mozart/src/commands/update.rs @@ -630,7 +630,7 @@ pub fn apply_minimal_changes( // Main execute function // ───────────────────────────────────────────────────────────────────────────── -pub fn execute( +pub async fn execute( args: &UpdateArgs, cli: &super::Cli, console: &mozart_core::console::Console, @@ -743,7 +743,7 @@ pub fn execute( } console.info("Resolving dependencies..."); - let mut resolved = match resolver::resolve(&request) { + let mut resolved = match resolver::resolve(&request).await { Ok(packages) => packages, Err(e) => { return Err(mozart_core::exit_code::bail( @@ -859,7 +859,8 @@ pub fn execute( composer_json: composer_json.clone(), include_dev: dev_mode, repo_cache: None, - })?; + }) + .await?; // Step 10: Compute and print change report let changes = compute_update_changes(old_lock.as_ref(), &new_lock, dev_mode); @@ -968,7 +969,8 @@ pub fn execute( apcu_autoloader: false, apcu_autoloader_prefix: None, }, - )?; + ) + .await?; } Ok(()) @@ -1657,9 +1659,9 @@ mod tests { // ──────────── Integration test (network, #[ignore]) ──────────── - #[test] + #[tokio::test] #[ignore] - fn test_update_full_e2e() { + async fn test_update_full_e2e() { use mozart_core::package::RawPackageData; use mozart_registry::lockfile::{LockFileGenerationRequest, generate_lock_file}; use mozart_registry::resolver::{ResolveRequest, resolve}; @@ -1682,7 +1684,7 @@ mod tests { repo_cache: None, }; - let resolved = resolve(&request).expect("Resolution should succeed"); + let resolved = resolve(&request).await.expect("Resolution should succeed"); assert!(!resolved.is_empty()); assert!(resolved.iter().any(|p| p.name == "monolog/monolog")); @@ -1693,6 +1695,7 @@ mod tests { include_dev: false, repo_cache: None, }) + .await .expect("Lock file generation should succeed"); assert!(!lock.content_hash.is_empty()); |
