diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-17 17:51:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-17 17:51:12 +0900 |
| commit | c6b10bd024894f857bf35a8f84c5e273be6f860d (patch) | |
| tree | 395fe0cd8daaa1d2cae62636bdf4ef4cd0c2c6cf /crates/shirabe/src/main.rs | |
| parent | 01352ed44259d1b6d677d392099850534ecf33ce (diff) | |
| download | php-shirabe-c6b10bd024894f857bf35a8f84c5e273be6f860d.tar.gz php-shirabe-c6b10bd024894f857bf35a8f84c5e273be6f860d.tar.zst php-shirabe-c6b10bd024894f857bf35a8f84c5e273be6f860d.zip | |
refactor(http-downloader): drop the job table for a &self Semaphore core
Replaces Job/Request/JobHandle/id_gen/running_jobs/max_jobs with a
tokio::sync::Semaphore permit held for the duration of each request.
get/add/copy/add_copy are now &self (add/add_copy are also genuinely
async); a shared execute()/dispatch() core replaces
add_job/run_rfs_job/start_job/settle_job, returning the Response
directly instead of deferring to wait()/count_active_jobs()/
get_response() (all removed — confirmed zero callers, same for the
now-unused STATUS_* constants).
get()/copy() stay synchronous rather than becoming async wrappers
around add()/add_copy(), bridging via the existing sync_executor
instead of the curl_runtime() introduced for CurlDownloader: their
callers (~35 files reaching HttpDownloader) are mostly plain sync fns
with no async boundary anywhere in the call chain, and forcing that
propagation now would pull forward the dedicated async-propagation
task. curl-eligible requests still route through curl_runtime()
inside dispatch(), same as before — nesting sync_executor::block_on
(no real reactor) around curl_runtime().block_on() (a real, separate
Runtime) is safe; it's only nesting curl_runtime() inside itself that
would panic.
CurlDownloader no longer needs Rc<RefCell<>> wrapping despite the
original design sketch: since item 2 made all of its methods &self,
a plain Option<CurlDownloader> field works fine under HttpDownloader's
own &self methods.
get/add/copy/add_copy becoming &self (rather than &mut self) requires
no changes at any of their ~35 calling files: RefMut/Ref both deref to
a type that can call &self methods just fine.
Verified manually against real network I/O (sandbox disabled): `shirabe
show -a` (get()'s sync_executor-bridged path) and `shirabe
create-project` (add_copy()'s genuinely async path via file_downloader.rs)
both complete correctly with no hang.
Diffstat (limited to 'crates/shirabe/src/main.rs')
0 files changed, 0 insertions, 0 deletions
