perf: prefetch running containers, spawn_blocking for I/O, stage cleanup#95
Open
Jaro-c wants to merge 1 commit into
Open
perf: prefetch running containers, spawn_blocking for I/O, stage cleanup#95Jaro-c wants to merge 1 commit into
Jaro-c wants to merge 1 commit into
Conversation
PERF-003: up_with_options called is_container_running per container — each was a list_containers round-trip. Prefetch all running project containers once before the loop; check names against a HashSet. Removes the now-dead is_container_running helper from Engine. PERF-004: build_context_tar* functions run walkdir + file reads on the tokio thread. Wrap all three variants in spawn_blocking. PERF-005: pack_path and tar unpack in cp run blocking I/O on the tokio thread. Wrap both in spawn_blocking. STAGE-001: up_with_options did not call cleanup_temp_dir on failure. Wrap the up body in an async block, check result, and call cleanup_temp_dir before propagating any error. Closes #84 Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
up_with_optionscalledis_container_runningper container replica — each was a separatelist_containersround-trip. Replaced with a single prefetch of all running project containers into aHashSet; in-loop checks become O(1) hash lookups. Removes the now-deadis_container_runninghelper.build_context_tar*functions ranwalkdir+ file reads on the tokio executor thread. Wrapped all three variants (build_context_tar,build_context_tar_with_inline,build_context_tar_with_target) intokio::task::spawn_blocking.pack_path(tar creation) andtar::Archive::unpack(tar extraction) ran blocking I/O on the tokio thread. Wrapped both inspawn_blocking.up_with_optionsnever calledcleanup_temp_diron failure, leaving inline secret/config staging files behind. Wrapped the up body in an async block and callcleanup_temp_dirbefore propagating any error.Test plan
cargo check— clean, no warningscargo test— all tests passCloses #84