Remove unnecessary fixed sleep by adding predicate-based path check#700
Merged
tchaton merged 8 commits intoSep 4, 2025
Merged
Conversation
for more information, see https://pre-commit.ci
fixed checks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #700 +/- ##
===================================
Coverage 84% 84%
===================================
Files 52 52
Lines 7095 7103 +8
===================================
+ Hits 5970 5986 +16
+ Misses 1125 1117 -8 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves performance when loading datasets by replacing a fixed 0.5-second sleep with a predicate-based check that only waits when necessary. This optimization significantly speeds up cache loading scenarios with thousands of optimized directories.
- Introduces a
wait_for_predicateutility function for timeout-based conditional waiting - Replaces the fixed sleep with a conditional check that returns immediately if the path exists
- Maintains the same 0.5-second timeout for cases where the path doesn't exist initially
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
bhimrazy
approved these changes
Sep 2, 2025
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.
What does this PR do?
Replaces the fixed
time.sleep(0.5)with a predicate-based check usingwait_for_predicate.This removes unnecessary waiting when the dataset path already exists, while still handling cases where it appears slightly later.
This significantly speeds up cache loading when there are thousands of optimized dirs