When starting up the notify bot today, the first round of getPeriodicItems was observed to make >2500 calls to github for repository branches. This call originates from NotifyBot::isOfInterest, which looks for pre-integration branches matching the PR. There is one call for every PR being considered, plus pagination. The JDK repository has so many open PRs at them moment that this call needs 8 pages. ~200 PRs x 8 pages is 1600 calls just for that repo.
This can be fixed pretty easily by just fetching branches once for each getPeriodicItems call. We may even consider doing it lazily to further reduce load when there are no open PRs in a repo. On the other hand, perhaps we shouldn't try to evaluate PRs in getPeriodicItems at all. It may look like a quick check, but fetching all PR comments for every PR, in addition to the already observed inefficiency with branches, is a lot of work. It also scales up linearly with the number of PRs returned, something that should be avoided in getPeriodicItems. It would be better to move this check to the WorkItem::run method, so that it's not holding up the serial execution in getPeriodicItems. It may still be worth fetching branches just once and supply that list to the PullRequestWorkItem.
This can be fixed pretty easily by just fetching branches once for each getPeriodicItems call. We may even consider doing it lazily to further reduce load when there are no open PRs in a repo. On the other hand, perhaps we shouldn't try to evaluate PRs in getPeriodicItems at all. It may look like a quick check, but fetching all PR comments for every PR, in addition to the already observed inefficiency with branches, is a lot of work. It also scales up linearly with the number of PRs returned, something that should be avoided in getPeriodicItems. It would be better to move this check to the WorkItem::run method, so that it's not holding up the serial execution in getPeriodicItems. It may still be worth fetching branches just once and supply that list to the PullRequestWorkItem.
- relates to
-
SKARA-1188 The pr/NNNN branches are not always deleted when a PR is closed
-
- Resolved
-