Index: scripts/master/try_job_rietveld.py |
diff --git a/scripts/master/try_job_rietveld.py b/scripts/master/try_job_rietveld.py |
index 1682a0327c3ee91114942a08377362dac3106384..ecbec709d949aad4f25c9ae18c2e0395c45b1277 100644 |
--- a/scripts/master/try_job_rietveld.py |
+++ b/scripts/master/try_job_rietveld.py |
@@ -23,6 +23,10 @@ from master import master_utils |
from master.try_job_base import TryJobBase |
+# Number of recent buildsets used to initialize RietveldPollerWithCache's cache. |
+MAX_RECENT_BUILDSETS_TO_INIT_CACHE = 10000 |
+ |
+ |
class _ValidUserPoller(internet.TimerService): |
"""Check chromium-access for users allowed to send jobs from Rietveld. |
""" |
@@ -241,10 +245,11 @@ class _RietveldPollerWithCache(base.PollingChangeSource): |
def _InitProcessedKeysCache(self): |
log.msg('[RPWC] Initializing processed keys cache...') |
- # Get all BuildBot build requests. |
- brdicts = yield self.master.db.buildrequests.getBuildRequests() |
+ # Get recent BuildBot buildsets. |
Paweł Hajdan Jr.
2014/06/03 08:08:47
nit: Add a comment here that we need to limit the
Sergiy Byelozyorov
2014/06/03 08:20:01
Done.
|
+ bsdicts = yield self.master.db.buildsets.getRecentBuildsets( |
+ MAX_RECENT_BUILDSETS_TO_INIT_CACHE) |
- log.msg('[RPWC] Received %d build request dicts' % len(brdicts)) |
+ log.msg('[RPWC] Received %d buildset dicts' % len(bsdicts)) |
def asNaiveUTC(dt): |
if dt is None: |
@@ -256,10 +261,10 @@ class _RietveldPollerWithCache(base.PollingChangeSource): |
# Compose a map of buildset ids to the submission timestamp. |
buildsets = {} |
- for brdict in brdicts: |
- bsid = brdict.get('buildsetid') |
+ for bsdict in bsdicts: |
+ bsid = bsdict.get('bsid') |
if bsid is not None: |
- buildsets[bsid] = asNaiveUTC(brdict.get('submitted_at')) |
+ buildsets[bsid] = asNaiveUTC(bsdict.get('submitted_at')) |
log.msg('[RPWC] Processing %d buildsets' % len(buildsets)) |