As of v0.3.0 (c73dc6c).
Summary
Two small internal cleanups in src/worker/mod.rs, bundled because they touch the same event loop:
handle_request_chunk takes 9 arguments and carries a #[allow(clippy::too_many_arguments)] (src/worker/mod.rs:174). The warned_config_error / warned_config_warnings flags are conceptually part of ConfigState, and decoder/cache/response/active_prompt are loop-lifetime state. Absorbing the warning flags into ConfigState and holding the rest in a WorkerLoop struct with methods removes the allow and makes the data flow explicit.
defer_job_result spawns a thread per deferred result (src/worker/mod.rs:293) to honor the min_loading_ms floor. With MAX_CONCURRENCY = 2 this is harmless in practice, but the event loop could instead keep a small queue of (deadline, JobResult) and use recv_timeout until the earliest deadline, eliminating ad-hoc thread creation.
Proposed fix
- Move
warned_config_error and warned_config_warnings into ConfigState.
- Introduce a
WorkerLoop (or similar) struct owning decoder, cache, response, active_prompt, job_pool, and config_state; convert the free functions into methods.
- Replace
defer_job_result's thread::spawn + sleep with deadline-aware recv_timeout in the main loop.
No behavior change intended; existing worker tests should pass as-is.
🤖 Generated with Claude Code — Claude Fable 5
As of v0.3.0 (c73dc6c).
Summary
Two small internal cleanups in
src/worker/mod.rs, bundled because they touch the same event loop:handle_request_chunktakes 9 arguments and carries a#[allow(clippy::too_many_arguments)](src/worker/mod.rs:174). Thewarned_config_error/warned_config_warningsflags are conceptually part ofConfigState, anddecoder/cache/response/active_promptare loop-lifetime state. Absorbing the warning flags intoConfigStateand holding the rest in aWorkerLoopstruct with methods removes the allow and makes the data flow explicit.defer_job_resultspawns a thread per deferred result (src/worker/mod.rs:293) to honor themin_loading_msfloor. WithMAX_CONCURRENCY = 2this is harmless in practice, but the event loop could instead keep a small queue of(deadline, JobResult)and userecv_timeoutuntil the earliest deadline, eliminating ad-hoc thread creation.Proposed fix
warned_config_errorandwarned_config_warningsintoConfigState.WorkerLoop(or similar) struct owningdecoder,cache,response,active_prompt,job_pool, andconfig_state; convert the free functions into methods.defer_job_result'sthread::spawn+sleepwith deadline-awarerecv_timeoutin the main loop.No behavior change intended; existing worker tests should pass as-is.
🤖 Generated with Claude Code — Claude Fable 5