@@ -78,40 +78,47 @@ def __init__(self, reports_dir=None):
78
78
for report in self .list_reports (repo , nb = 1 ):
79
79
self .download_report (report )
80
80
81
- def ingest_pushes (self , repository , min_push_id = None , nb_pages = 3 ):
81
+ def ingest_pushes (self , repository , platform , suite , min_push_id = None , nb_pages = 3 ):
82
82
"""
83
83
Ingest HGMO changesets and pushes into our Redis Cache
84
84
The pagination goes from oldest to newest, starting from the optional min_push_id
85
85
"""
86
+ ingested = False
86
87
for push_id , push in hgmo_pushes (repository , min_push_id , nb_pages ):
87
88
for changeset in push ["changesets" ]:
88
89
# TODO: look all neighboring reports on GCP
89
90
report = Report (
90
91
self .reports_dir ,
91
92
repository ,
92
93
changeset ,
94
+ platform ,
95
+ suite ,
93
96
push_id = push_id ,
94
97
date = push ["date" ],
95
98
)
96
- if self .ingest_report (report ):
99
+
100
+ # Always link changeset to push to find closest available report
101
+ self .redis .hmset (
102
+ KEY_CHANGESET .format (
103
+ repository = report .repository , changeset = report .changeset
104
+ ),
105
+ {"push" : report .push_id , "date" : report .date },
106
+ )
107
+
108
+ if not ingested and self .ingest_report (report ):
97
109
logger .info (
98
110
"Found report in that push" , push_id = push_id , report = str (report )
99
111
)
100
112
113
+ # Only ingest first report found in a push in order to stay below 30s response time
114
+ ingested = True
115
+
101
116
def ingest_report (self , report ):
102
117
"""
103
118
When a report exist for a changeset, download it and update redis data
104
119
"""
105
120
assert isinstance (report , Report )
106
121
107
- # Always link changeset to push to find closest available report
108
- self .redis .hmset (
109
- KEY_CHANGESET .format (
110
- repository = report .repository , changeset = report .changeset
111
- ),
112
- {"push" : report .push_id , "date" : report .date },
113
- )
114
-
115
122
# Download the report
116
123
if not self .download_report (report ):
117
124
logger .info ("Report not available" , report = str (report ))
@@ -228,7 +235,9 @@ def find_closest_report(
228
235
push_id , _ = hgmo_revision_details (repository , changeset )
229
236
230
237
# Ingest pushes as we clearly don't have it in cache
231
- self .ingest_pushes (repository , min_push_id = push_id - 1 , nb_pages = 1 )
238
+ self .ingest_pushes (
239
+ repository , platform , suite , min_push_id = push_id - 1 , nb_pages = 1
240
+ )
232
241
233
242
# Load report from that push
234
243
return self .find_report (
0 commit comments