Optimize async I/O and locking patterns to reduce runtime blocking #1552
+27
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identified and fixed performance bottlenecks: blocking file I/O in async contexts and inefficient locking for read-heavy credential access.
Changes
Replace blocking filesystem operations with async equivalents
api/update.rs: Usetokio::fs::writeinstead ofstd::fs::writewhen writing update manifestsrecording.rs: ConvertJrecManifest::{read_from_file, save_to_file}to async methods usingtokio::fsservice.rs: Makeload_jrl_from_diskasync to usetokio::fs::read_to_stringBefore:
After:
Use RwLock for credential store to enable concurrent reads
credential.rs: ReplaceArc<Mutex<CredentialStore>>withArc<RwLock<CredentialStore>>.get()) use.read()lock, allowing concurrent credential lookups.insert(), cleanup task) use.write()lockOptimize byte array conversion in plugin manager
plugin_manager/recording.rs: Changeiter().map(|e| *e)tointo_iter().map(|e| e)to eliminate unnecessary dereferencingOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.