bulldozer icon indicating copy to clipboard operation
bulldozer copied to clipboard

Add delay between pull request updates

Open bluekeyes opened this issue 3 years ago • 2 comments

In projects with many open PRs using the automatic updates feature, Bulldozer can trigger GitHub's secondary rate limits by updating (and possibly querying) pull requests too quickly. To avoid this, add some delay between operations.

For queries, use a fixed 250ms delay for now. This shouldn't slow things down too much, but does prevent Bulldozer from blasting through PRs as fast as possible.

For updates, use an exponential delay that starts at 1s and maxes out at 60s. I believe the secondary limits (at least for GitHub Enterprise) are computed over a minute, so this will limit us to one update per minute for large batches. I don't think this will be prohibitively slow, but we could explore making this configurable in the future.

As part of this, refactor the logic so that we don't block queries on previous updates.

This should help with the issues reported in #276. Requires #277 to merge first.

bluekeyes avatar Jan 22 '22 02:01 bluekeyes

Based on @daiglebg's testing in #276, I've changed this to use a fixed 2 second delay for updates. With the maximum value that low, exponential backoff hit the limit so fast that the complexity didn't seem worthwhile. To compensate, I've added configuration options for both delays so that users can increase them or disable them if needed.

The configuration is undocumented for now, as I think most people should use the defaults.

bluekeyes avatar Jan 24 '22 21:01 bluekeyes

@bluekeyes are you still interested in merging this?

asvoboda avatar May 20 '22 13:05 asvoboda