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
diff --git a/tests/base.py b/tests/base.py
index 76d604f..ecbe5c8 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -949,7 +949,8 @@
'repo': {
'full_name': pr.project
}
- }
+ },
+ 'files': pr.files
}
return data
@@ -960,10 +961,6 @@
pr = prs[0]
return self.getPull(pr.project, pr.number)
- def getPullFileNames(self, project, number):
- pr = self.pull_requests[number - 1]
- return pr.files
-
def _getPullReviews(self, owner, project, number):
pr = self.pull_requests[number - 1]
return pr.reviews