Skip to content
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

Reduce API calls #337

Merged
merged 1 commit into from
May 20, 2016
Merged

Conversation

mmitche
Copy link
Contributor

@mmitche mmitche commented May 12, 2016

This change reduces the number of API calls made by the ghprb plugin. .NET CI was hitting rate limits pretty regularly. There are a few major improvements:
* When using webhooks, we do not check comments (pull comment data) except when absolutely necessary. We recieve all the comment info through the hooks, so we only need to check for updated comments when we have a new pull request or when jenkins restarts.
* Never force a GH pull request update when a comment update comes through. If a comment update came through, we're using webhooks and will have gotten the updated PR event.
* initGhRepository isn't necessary when a GhprbRepository is created. It's not used in the pull request trigger init, and causes an API call. It can be called on demand as necessary. This also dramatically improves startup time in Jenkins instances that have a lot of PR triggered jobs

Additional fixes:
* Fixes a case where the pull request data wasn't saved on a GH hash update (which leads to most PRs restarting testing on any comment if Jenkins restarts)
* Fixes a potential race condition where multiple triggers would attempt to set up hooks at the same time.

Not all possible improvements are included. When a new PR or updated PR event is sent to Jenkins, we could pull the GHPullRequest info for affected projects once, instead of for each project which we do today.

This change reduces the number of API calls made by the ghprb plugin.  .NET CI was hitting rate limits pretty regularly.  There are a few major improvements:
    * When using webhooks, we do not check comments (pull comment data) except when absolutely necessary.   We recieve all the comment info through the hooks, so we only need to check for updated comments when we have a new pull request or when jenkins restarts.
    * Never force a GH pull request update when a comment update comes through.  If a comment update came through, we're using webhooks and will have gotten the updated PR event.
    * initGhRepository isn't necessary when a GhprbRepository is created.  It's not used in the pull request trigger init, and causes an API call.  It can be called on demand as necessary.  This also dramatically improves startup time in Jenkins instances that have a lot of PR triggered jobs

Additional fixes:
    * Fixes a case where the pull request data wasn't saved on a GH hash update (which leads to most PRs restarting testing on any comment if Jenkins restarts)
    * Fixes a potential race condition where multiple triggers would attempt to set up hooks at the same time.

Not all possible improvements are included.  When a new PR or updated PR event is sent to Jenkins, we could pull the GHPullRequest info for affected projects once, instead of for each project which we do today.
@DavidTanner DavidTanner merged commit b685ba3 into jenkinsci:master May 20, 2016
nosmo pushed a commit to nosmo/ghprb-plugin that referenced this pull request Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants