- 
                Notifications
    
You must be signed in to change notification settings  - Fork 79
 
Remove unnecessary fixed sleep by adding predicate-based path check #700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary fixed sleep by adding predicate-based path check #700
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:
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
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