Better timeout options handling in wait started#451
Merged
aalexfvk merged 4 commits intoyandex:mainfrom Mar 17, 2026
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts timeout handling for the 'wait started' file-based timeout strategy to support --timeout with the default strategy and to ensure sane defaults when only one of min/max timeout is provided. Flow diagram for updated timeout calculation logic in get_timeout_by_filesflowchart TD
A["Start get_timeout_by_files"] --> B["Set file_processing_speed to provided value or DEFAULT_FILE_PROCESSING_SPEED"]
B --> C{"Is min_timeout None and max_timeout None?"}
C -->|"Yes"| D["Set min_timeout to DEFAULT_MIN_TIMEOUT"]
D --> E["Set max_timeout to DEFAULT_MAX_TIMEOUT"]
C -->|"No"| F{"Is min_timeout None?"}
F -->|"Yes"| G["Set min_timeout to min(DEFAULT_MIN_TIMEOUT, max_timeout)"]
F -->|"No"| H{"Is max_timeout None?"}
H -->|"Yes"| I["Set max_timeout to max(DEFAULT_MAX_TIMEOUT, min_timeout)"]
H -->|"No"| J["Keep provided min_timeout and max_timeout"]
E --> K["Compute file_processing_timeout as get_file_count() divided by file_processing_speed"]
G --> K
I --> K
J --> K
K --> L["Compute clamped_timeout as max(min_timeout, min(file_processing_timeout, max_timeout))"]
L --> M["Return clamped_timeout"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
get_timeout_by_files, consider explicitly validating and raising a clear error when bothmin_timeoutandmax_timeoutare provided butmin_timeout > max_timeout, since the current clamp logic will silently return a value greater than the user-specifiedmax_timeout. - The branching in
get_timeout_by_filesfor derivingmin_timeout/max_timeoutfrom defaults and user input is becoming a bit dense; consider extracting this into a small helper or adding a short inline comment describing the intended precedence rules to make future maintenance easier.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `get_timeout_by_files`, consider explicitly validating and raising a clear error when both `min_timeout` and `max_timeout` are provided but `min_timeout > max_timeout`, since the current clamp logic will silently return a value greater than the user-specified `max_timeout`.
- The branching in `get_timeout_by_files` for deriving `min_timeout`/`max_timeout` from defaults and user input is becoming a bit dense; consider extracting this into a small helper or adding a short inline comment describing the intended precedence rules to make future maintenance easier.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
aalexfvk
approved these changes
Mar 11, 2026
Contributor
|
Rebase pls |
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.
Allows to use --timeout with default timeout strategy and handles the case when only max-timeout is passed and is lesser than default min_timeout
Summary by Sourcery
Adjust timeout handling for file-based wait strategy to better support default values and user-provided limits.
Enhancements: