diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-17 16:37:58 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-17 16:37:58 +0900 |
| commit | c5c527d87425ff93a4f983d36e12bd1c4b565e52 (patch) | |
| tree | 47696883b4f7bf132f6dc6ebc1db777ab57addbc /crates/shirabe/src/io/io_interface.rs | |
| parent | 2dc55eec52ee2c6993e64d8bb11c96a4f2ec5c6d (diff) | |
| download | php-shirabe-c5c527d87425ff93a4f983d36e12bd1c4b565e52.tar.gz php-shirabe-c5c527d87425ff93a4f983d36e12bd1c4b565e52.tar.zst php-shirabe-c5c527d87425ff93a4f983d36e12bd1c4b565e52.zip | |
refactor(curl-downloader): rewrite as a single async fn, drop Job/tick
Replaces the Job-table + tick()-driven polling loop with one async
download() that sends, decides (retry/redirect/fail/succeed via a new
decide() extracted from the former run_job), and loops until it
resolves — no more resolve/reject callbacks. The client switches from
reqwest::blocking::Client to the non-blocking reqwest::Client, with
body streaming now via tokio::fs.
Because real async I/O needs a live tokio reactor and none runs yet at
the process level (sync_executor::block_on is a no-reactor busy-spin
executor that only works when awaited futures resolve synchronously),
HttpDownloader::start_job drives CurlDownloader::download() through a
dedicated temporary current_thread Runtime (curl_runtime(), marked
TODO(phase-e)) instead. This keeps concurrency characteristics
unchanged for now — start_job still resolves one job at a time — real
parallel I/O lands once HttpDownloader/Loop are rearchitected on top of
FuturesUnordered.
count_active_jobs' curl.tick() polling and the Job.settled/curl_id
plumbing are removed as dead weight now that start_job settles curl
jobs synchronously, same as the rfs path already did.
abort_request is dropped: it had no caller (the PHP Promise-cancellation
flow it backs was never ported), and the job table it operated on no
longer exists.
Verified manually against real network I/O (sandbox disabled): `shirabe
show -a` (JSON metadata, in-memory body) and `shirabe create-project`
(actual dist zip download + extraction) both complete correctly with no
hang. Two unrelated pre-existing bugs surfaced during manual testing
(an event-dispatcher subscriber wiring gap during `require`, and a
RefCell reentrancy panic in `diagnose`) reproduce identically on the
pre-change code and are out of scope here.
Diffstat (limited to 'crates/shirabe/src/io/io_interface.rs')
0 files changed, 0 insertions, 0 deletions
