diff options
author | Jesse Keating <omgjlk@us.ibm.com> | 2017-06-08 15:08:27 -0700 |
---|---|---|
committer | Jesse Keating <omgjlk@us.ibm.com> | 2017-06-08 15:51:32 -0700 |
commit | 61040e7ccba2898459c9cef79779391dbd1f6803 (patch) | |
tree | 4e202e54b2620b0c5f372f90fb73de99074eea64 /zuul/driver/github/githubsource.py | |
parent | 9b019d8c0337d5c2a13f4bb06366003b996e8576 (diff) | |
download | zuul-61040e7ccba2898459c9cef79779391dbd1f6803.tar.gz |
Implement a cache of github change objects
This adds a cache of github change objects (PullRequests with associated
data). As an event comes in, the cache is checked for a matching change,
and the data is updated. If no change exists a new one is created and
"updated". When the change queue is processed, the change in question is
pulled from the cache without updating it, saving numerous API calls.
As events come in, the very same object is updated with new data, so
that when the change queue is processed it has the latest known data for
a given change.
This will drasticaly reduce the number of API calls that were made via
the github API, as well as set things up nicely for switching over to
GraphQL as it becomes possible.
Change-Id: If99505c7bcfebe0916eeb8e4ccaa47cf97f2cc9a
Story: 2000774
Task: 4610
Diffstat (limited to 'zuul/driver/github/githubsource.py')
-rw-r--r-- | zuul/driver/github/githubsource.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/zuul/driver/github/githubsource.py b/zuul/driver/github/githubsource.py index 1350b1095..1c2f72718 100644 --- a/zuul/driver/github/githubsource.py +++ b/zuul/driver/github/githubsource.py @@ -58,8 +58,8 @@ class GithubSource(BaseSource): """Called after configuration has been processed.""" pass - def getChange(self, event): - return self.connection.getChange(event) + def getChange(self, event, refresh=False): + return self.connection.getChange(event, refresh) def getProject(self, name): p = self.connection.getProject(name) @@ -87,10 +87,6 @@ class GithubSource(BaseSource): """Get the git-web url for a project.""" return self.connection.getGitwebUrl(project, sha) - def getPullFiles(self, project, number): - """Get filenames of the pull request""" - return self.connection.getPullFileNames(project, number) - def _ghTimestampToDate(self, timestamp): return time.strptime(timestamp, '%Y-%m-%dT%H:%M:%SZ') |