@@ -135,56 +135,21 @@ def log_object_path(full_name, job_id):
135135 return f"log/{ full_name } /{ job_id } "
136136
137137
138- def classifier_payload (full_name , job_id ):
139- """An API Gateway HTTP API v2.0 request, which is what lambda_http parses.
140-
141- log_classifier is built on lambda_http with only the `apigw_http` feature, so
142- it expects this envelope even on a direct invoke. Verified against the
143- deployed function: a payload with no `job_id` returns its 400 "no job id
144- provided" branch, and a non-numeric one fails in its `parse::<usize>()`,
145- which together show both the envelope and the query string are read.
146- """
147- return {
148- "version" : "2.0" ,
149- "routeKey" : "$default" ,
150- "rawPath" : "/" ,
151- "rawQueryString" : f"job_id={ job_id } &repo={ full_name } " ,
152- "headers" : {},
153- "queryStringParameters" : {"job_id" : str (job_id ), "repo" : full_name },
154- "requestContext" : {
155- "accountId" : "308535385114" ,
156- "apiId" : "gha-log-uploader" ,
157- "domainName" : "lambda-invoke" ,
158- "domainPrefix" : "lambda-invoke" ,
159- "http" : {
160- "method" : "GET" ,
161- "path" : "/" ,
162- "protocol" : "HTTP/1.1" ,
163- "sourceIp" : "127.0.0.1" ,
164- "userAgent" : "gha-log-uploader" ,
165- },
166- "requestId" : f"gha-log-uploader-{ job_id } " ,
167- "routeKey" : "$default" ,
168- "stage" : "$default" ,
169- "time" : "01/Jan/1970:00:00:00 +0000" ,
170- "timeEpoch" : 0 ,
171- },
172- "isBase64Encoded" : False ,
173- }
174-
175-
176138def classify_log (full_name , job_id ):
177139 """Kick off classification for a log we just stored. Returns True on handoff.
178140
179141 Asynchronous, and reached through `lambda:InvokeFunction` rather than
180142 log_classifier's public function URL, so the path from here to classification
181- never crosses a public endpoint.
143+ never crosses a public endpoint. A function URL would not do: it only supports
144+ the RequestResponse invocation type, so using one means waiting for
145+ classification to finish -- which is exactly the mistake that gave
146+ github-status-test its multi-hundred-second tails.
182147 """
183148 try :
184149 lambda_client .invoke (
185150 FunctionName = LOG_CLASSIFIER_FUNCTION ,
186151 InvocationType = "Event" ,
187- Payload = json .dumps (classifier_payload ( full_name , job_id ) ).encode (),
152+ Payload = json .dumps ({ "job_id" : job_id , "repo" : full_name } ).encode (),
188153 )
189154 return True
190155 except Exception as err :
0 commit comments