Skip to content
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

Prevent infinite loop in Command::Base#step & add configurable wait time #217

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/command/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def step_finish(success, abort_on_error: true)
end
end

def step(message, abort_on_error: true, retry_on_failure: false, max_retry_count: 5, wait: 1) # rubocop:disable Metrics/MethodLength
def step(message, abort_on_error: true, retry_on_failure: false, max_retry_count: Float::INFINITY, wait: 1) # rubocop:disable Metrics/MethodLength
progress.print("#{message}...")

Shell.use_tmp_stderr do
Expand Down
11 changes: 0 additions & 11 deletions spec/command/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
context "with retry_on_failure: true" do
let(:options) { { retry_on_failure: true, wait: 0 } }

it "does not exceed default max_retry_count" do
zzaakiirr marked this conversation as resolved.
Show resolved Hide resolved
run_count = 0

command.step(message, **options) do
run_count += 1
false
end

expect(run_count).to eq 5
end

it "retries block until success" do
run_count = 0
zzaakiirr marked this conversation as resolved.
Show resolved Hide resolved

Expand Down