agent: Continue to retry indefinitely #3599
Merged
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.
When the woodpecker server is not reachable (eg. for update, maintenance, agent connection issue, ...) for a long period of time, the agent tries continuously to reconnect, without any delay. This creates several GB of logs in a short period of time.
Here is a sample line, repeated indefinitely:
It appears that the backoff package, after a certain amount of time, returns
backoff.Stop
(-1) instead of a valid delay to wait. It means that no more retry should be made, as shown in the example. But the code doesn't handle that case and takes -1 as the next delay.This led to continuous retry with no delay between them and creates a huge amount of logs.
MaxElapsedTime
default is 15 minutes, passed this time,NextBackOff
returnsbackoff.Stop
(-1) instead ofMaxInterval
.This commit sets
MaxElapsedTime
to 0, to avoidStop
return.