Skip to content

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

Description

@Nsanjayboruds

What happened:
The codebase currently contains direct usages of the WaitNext function in the pkg/backoff package. There is a TODO comment at pkg/backoff/backoff.go:65 indicating that using WaitNext directly can lead to panics in certain scenarios, and we need to refactor these usages.

What you expected to happen:
To avoid potential panics and improve stability, all usages of WaitNext outside of the pkg/backoff package should be replaced with the safer Do method. The Do method encapsulates the retry logic and executes operations safely without risking panics from improper loop handling.

How to reproduce it:
This is a proactive code refactoring task rather than a runtime bug reproduction.

  1. Check pkg/backoff/backoff.go line 65 to see the TODO.
  2. Search the codebase for invocations of WaitNext(ctx) on retry interfaces/objects to see where refactoring is needed.

Environment:

  • piped version: N/A (Codebase refactoring)
  • control-plane version: N/A
  • Others: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions