-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retry commit loading when pushed dates are missing #500
Conversation
Back in 1d06dfa, I removed retries for pushed date loading, preferring to always use a fallback API. This seemed to work better in most cases, but we're still seeing persistent but temporary failures loading pushed dates for certain merge commits. Add retries for the whole process again, covering both the initial pull request API and the fallback commit APIs, in the hope that this gives enough time for GitHub to update the internal data.
// Retry with exponential backoff until it works or we hit the max total | ||
// latency to avoid users thinking the bot got stuck or dropped an event. | ||
const baseDelay = 1 * time.Second | ||
const maxLatency = 20 * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doing a time-bounded retry is a bit easier to think about than a retry count, but open to switching this to a more traditional N attempts where we manually compute the expected max latency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can add loggging to make it clear that our worker thread is in a long sleep? If for whatever reason we've failed a few times in a row, its hard to know why its not doing anything from the logs.
} | ||
} | ||
|
||
func (ghc *GitHubContext) loadCommitsOnce() (head *Commit, commits []*Commit, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll assume that this is only called one function above so we can have it do whatever.
break | ||
} | ||
log.Debug().Dur("delay", delay).Str("sha", ghc.pr.HeadRefOID).Msg("Head commit is missing pushed data, sleeping and trying again") | ||
time.Sleep(delay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message was going to be my suggestion for the above, so I think I'm happy.
Back in 1d06dfa, I removed retries for pushed date loading, preferring to always use a fallback API. This seemed to work better in most cases, but we're still seeing persistent but temporary failures loading pushed dates for certain merge commits.
Add retries for the whole process again, covering both the initial pull request API and the fallback commit APIs, in the hope that this gives enough time for GitHub to update the internal data.