diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-17 22:12:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-17 22:12:35 +0900 |
| commit | ccef521aa73e724d25c40e60ec3c08f2b0863e3b (patch) | |
| tree | bbb3874005e9c48d4ed34116f04444a232bc723e /crates/shirabe/src/repository/composer_repository.rs | |
| parent | cfcd24b15c8e551e094884e2841a41a23d610ef0 (diff) | |
| download | php-shirabe-ccef521aa73e724d25c40e60ec3c08f2b0863e3b.tar.gz php-shirabe-ccef521aa73e724d25c40e60ec3c08f2b0863e3b.tar.zst php-shirabe-ccef521aa73e724d25c40e60ec3c08f2b0863e3b.zip | |
perf(sync-executor): drive HTTP fetches through one real top-level runtime
Replace sync_executor::block_on's reactor-less busy-spin poller with
tokio::task::block_in_place + Handle::current().block_on(), riding a
single tokio Runtime entered once in main.rs (falling back to a
disposable one when no ambient runtime exists, e.g. in tests). This
lets HttpDownloader::dispatch await CurlDownloader::download directly
instead of bouncing through the separate curl_runtime() bridge, which
is now deleted.
Manual create-project verification against the real network caught a
concurrency bug this exposed: async_fetch_file held http_downloader's
RefMut across the await on add(), which only panics once downloads
genuinely overlap. add() only needs &self, so borrow() fixes it.
With everything now sharing one real reactor, the FuturesOrdered
fan-out added for ComposerRepository::get_security_advisories/
load_async_packages finally overlaps for real: fetching 8 packages'
metadata dropped from ~7-40s to a consistent ~3-4s in a before/after
comparison, with identical resulting lock files.
sync_executor::block_on's call sites are still synchronous rather
than async fn propagated up to Command::execute, which remains the
end goal (see the TODO(phase-e) in sync_executor.rs) - nested block_on
calls elsewhere don't get this same overlap, only prevented panics.
Diffstat (limited to 'crates/shirabe/src/repository/composer_repository.rs')
| -rw-r--r-- | crates/shirabe/src/repository/composer_repository.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs index 1b04de39..f3f75ea2 100644 --- a/crates/shirabe/src/repository/composer_repository.rs +++ b/crates/shirabe/src/repository/composer_repository.rs @@ -3155,11 +3155,7 @@ impl ComposerRepository { } } - let response_result = self - .http_downloader - .borrow_mut() - .add(&filename, options) - .await; + let response_result = self.http_downloader.borrow().add(&filename, options).await; match response_result { Ok(response) => self.async_fetch_file_accept(response, &filename, cache_key), Err(e) => self.async_fetch_file_reject(e, &filename, cache_key, last_modified_time), |
