Skip to content

refactor: replace WaitNext with retry.Do in piped components#6996

Open
Nsanjayboruds wants to merge 2 commits into
pipe-cd:masterfrom
Nsanjayboruds:refactor-waitnext-to-do
Open

refactor: replace WaitNext with retry.Do in piped components#6996
Nsanjayboruds wants to merge 2 commits into
pipe-cd:masterfrom
Nsanjayboruds:refactor-waitnext-to-do

Conversation

@Nsanjayboruds

Copy link
Copy Markdown

What this PR does:
Refactors the piped component to replace all direct usages of the unsafe backoff.WaitNext method with the safer, closure-based retry.Do pattern.
Additionally, the WaitNext function in pkg/backoff/backoff.go has been unexported (renamed to waitNext) and removed from the Retry interface to prevent future unsafe usage in the codebase.

Why we need it:
The imperative WaitNext retry loop approach was identified as unsafe because it could potentially lead to panics or skipped retries if a panic or unexpected error occurred inside the loop block. Migrating to the functional retry.Do closure ensures that execution logic and error handling (such as pipedservice.Retriable(err)) are properly encapsulated and safely managed by the retry mechanism.

Which issue(s) this PR fixes:

Fixes #6995

Does this PR introduce a user-facing change?:
No

  • How are users affected by this change: N/A
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Signed-off-by: Nsanjayboruds <nishantborude555@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Replace WaitNext usages with Do in backoff package to avoid panics

1 participant