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

[bug fix] Step retries for max retry even if step state is not error #17

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

TanmoySG
Copy link
Owner

@TanmoySG TanmoySG commented Nov 7, 2024

A step would retry for all errors for MaxRunAttempts even when step moved out of Error State.

Cause

  • shouldRetry returns true if step.StepOpts.RetryAllErrors is set to true, without checking if step.stepResult.StepState is in Error state.
	if step.StepOpts.RetryAllErrors {
		return true
	}

Fix

  • Adding check for step.stepResult.StepState to be StepStateError in addition to the RetryAllErrors fixes this bug.
	if step.stepResult.StepState == StepStateError && step.StepOpts.RetryAllErrors {
		return true
	}

In addition step.StepOpts.MaxRunAttempts == step.stepRunProgress.runCount has been removed from shouldExit


This pull request includes changes to the go_steps.go file to enhance the retry and exit logic for steps. The most important changes include adding a condition to check the step state before retrying and refactoring the exit logic to use a switch statement.

Enhancements to retry logic:

  • go_steps.go: Updated the shouldRetry method to include a condition that checks if the step state is StepStateError before retrying.

Refactoring exit logic:

  • go_steps.go: Refactored the shouldExit method to use a switch statement for better readability and removed the redundant return statement.

@TanmoySG TanmoySG merged commit ecf3bef into main Nov 7, 2024
1 check passed
@TanmoySG TanmoySG deleted the retry-all-error-bug-fix branch November 7, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant