refactor: replace legacy WaitNext retry loops with thread-safe backoff.Do closures#6916
Closed
Parthtiw710 wants to merge 1 commit into
Closed
refactor: replace legacy WaitNext retry loops with thread-safe backoff.Do closures#6916Parthtiw710 wants to merge 1 commit into
Parthtiw710 wants to merge 1 commit into
Conversation
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.
PR Description
Description
This PR addresses the technical debt of legacy
WaitNext()retry loops in thepipedapplication, resolving the project-wide TODO inpkg/backoff/backoff.go:// TODO: Find all using of WaitNext and replace by Do to avoid panic.By migrating all manual
WaitNextiterations topipedservice.NewRetry(N).Doclosures, we encapsulate retry states, prevent potential data races/concurrency panics, and standardize error propagation.Changes
1. Trigger Package (
pkg/app/piped/trigger/)cache.go: RefactoredgetLastTriggeredDeploymentusingbackoff.Doand standardpipedservice.NewRetriableErrwrapping. Added type assertion back to the expected*model.ApplicationDeploymentReferencereturn.deployment.go: UpdatedreportMostRecentlyTriggeredDeploymentto run inside a safe.Do()closure.2. Controller Package (
pkg/app/piped/controller/)controller.go: MigratedgetMostRecentlySuccessfulDeployment,cancelDeployment, andreportApplicationDeployingStatusto the safe.Do()pattern.planner.go:reportDeploymentPlanned,reportDeploymentFailed, andreportDeploymentCancelledto use.Do().reportDeploymentFailedwhereReportDeploymentPlannedwas incorrectly called instead ofReportDeploymentCompletedduring failure reporting.scheduler.go: MigratedreportStageStatus,reportDeploymentStatusChanged,reportDeploymentCompleted, andreportMostRecentlySuccessfulDeployment.3. Command Package (
pkg/app/piped/cmd/piped/)piped.go: RefactoredsendPipedMetato use.Do(). Kept the localretryvariable to preserve calling telemetry (retry.Calls()) inside warning logs.4. Platform Provider / Lambda (
pkg/app/piped/platformprovider/lambda/&pkg/app/piped/executor/lambda/)client.go: UpdatedupdateFunctionConfigurationto use.Do()loop instead ofWaitNext.lambda.go: Refactored thebuildstage publish step to run within a.Do()closure.Verification & Testing
All packages compile cleanly under Go 1.25.0 and all unit tests passed successfully:
No remaining
WaitNextreferences exist anywhere inpkg/app/piped: