You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(server): replace blocking I/O in async functions with tokio equivalents (#912)
* fix(server): replace blocking I/O in async functions with tokio equivalents
Convert all std::fs and std::thread::sleep calls inside async functions
to their tokio counterparts, preventing tokio worker thread starvation
under concurrent load.
Changes:
- server/push.rs: persist() uses tokio::fs::write/set_permissions/rename
- server/mod.rs: write_secret_file + load_or_generate_token made async
- cli/serve.rs: stop_daemon made async, thread::sleep -> tokio::time::sleep,
all fs ops -> tokio::fs, tunnel checks wrapped in spawn_blocking
- update/install.rs: download_tarball uses tokio::fs::File + AsyncWriteExt
server/api/git.rs and server/api/system.rs were already correctly wrapped
in spawn_blocking; no changes needed.
Closes#911
* fix(update): use sync_all instead of flush for crash-safe downloads
flush() only pushes to kernel buffers; sync_all() ensures data reaches
persistent storage, preventing corrupt-archive scenarios on power loss.
* fix(update): drop unused std::io::Write import after merge
The merge with main re-introduced std::io::Write, but download_tarball
now uses tokio::io::AsyncWriteExt instead. Caught by clippy
-D warnings.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---------
Co-authored-by: njbrake <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
0 commit comments