From f8e385f7a1bd752d39f4d4f87b0439596839dde9 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 18 Jul 2026 17:45:25 +0900 Subject: perf(process-executor): make execute_async genuinely concurrent execute_async was a serial pump: it queued a job, then drove it to completion itself via wait_id()'s blocking usleep loop before returning, so concurrent callers never overlapped even when polled together through FuturesUnordered. Rewrite it as a single &self async fn mirroring the CurlDownloader/ HttpDownloader rework: a tokio Semaphore sized by max_jobs (COMPOSER_MAX_PARALLEL_PROCESSES, PHP parity) gates admission, the child is started non-blocking, and an async 1ms sleep loop pumps is_running()/check_timeout() while yielding to the reactor so sibling jobs genuinely run in parallel. The Job table, STATUS_* lifecycle, start_job/mark_job_done/count_active_jobs/wait/wait_id all had no remaining callers and are removed. &self also lets callers hold only a shared borrow across their awaits (zip_downloader, version_guesser, filesystem via the new get_process_handle), which would otherwise panic with 'already mutably borrowed' once two async jobs overlap on the same Rc>. The async mock branch no longer consumes the expectation before hitting its todo!(): the panic made that bookkeeping unobservable. Co-Authored-By: Claude Fable 5 --- crates/shirabe/src/package/version/version_guesser.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crates/shirabe/src/package/version') diff --git a/crates/shirabe/src/package/version/version_guesser.rs b/crates/shirabe/src/package/version/version_guesser.rs index add59ead..f2a7c3ce 100644 --- a/crates/shirabe/src/package/version/version_guesser.rs +++ b/crates/shirabe/src/package/version/version_guesser.rs @@ -577,9 +577,7 @@ impl VersionGuesser { &scm_cmdline, ); let mut process = sync_executor::block_on( - self.process - .borrow_mut() - .execute_async(&cmd_line, Some(path)), + self.process.borrow().execute_async(&cmd_line, Some(path)), )?; if !process.is_successful() { continue; -- cgit v1.3.1