Skip to content

Commit 2cbbcd4

Browse files
authored
Increase max delay for commit retries (#509)
While the 20s max delay seems to work most of the time, since deploying this, about 5% of requests that needed retries still failed. Increase the latency to 35s to allow one more retry with some buffer for request times.
1 parent 7307b44 commit 2cbbcd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pull/github.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func (ghc *GitHubContext) loadCommits() ([]*Commit, error) {
806806
// Retry with exponential backoff until it works or we hit the max total
807807
// latency to avoid users thinking the bot got stuck or dropped an event.
808808
const baseDelay = 1 * time.Second
809-
const maxLatency = 20 * time.Second
809+
const maxLatency = 35 * time.Second
810810

811811
start := time.Now()
812812
for delay := baseDelay; true; delay *= 2 {
@@ -821,7 +821,7 @@ func (ghc *GitHubContext) loadCommits() ([]*Commit, error) {
821821
if time.Since(start)+delay >= maxLatency {
822822
break
823823
}
824-
log.Debug().Dur("delay", delay).Str("sha", ghc.pr.HeadRefOID).Msg("Head commit is missing pushed data, sleeping and trying again")
824+
log.Debug().Dur("delay", delay).Str("sha", ghc.pr.HeadRefOID).Msg("Head commit is missing pushed date, sleeping and trying again")
825825
time.Sleep(delay)
826826
}
827827

0 commit comments

Comments
 (0)