Skip to content

Commit 11aa8d8

Browse files
add logging for retry mechanism
1 parent 3ad3618 commit 11aa8d8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/lib/processSnapshot.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,21 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context):
178178
discoveryErrors.browsers[globalBrowser][globalViewport]?.push(data);
179179
}
180180

181-
let responseOfRetry
181+
let responseOfRetry, bodyOfRetry
182182
ctx.log.debug(`Resource had a disallowed status ${requestUrl} fetching from server again`);
183183
responseOfRetry = await page.request.fetch(request, requestOptions);
184-
body = await responseOfRetry.body();
184+
bodyOfRetry = await responseOfRetry.body();
185185

186186
if (responseOfRetry && responseOfRetry.status() && ALLOWED_STATUSES.includes(responseOfRetry.status())) {
187+
ctx.log.debug(`Handling request after retry ${requestUrl}\n - content-type ${responseOfRetry.headers()['content-type']}`);
187188
cache[requestUrl] = {
188-
body: body.toString('base64'),
189+
body: bodyOfRetry.toString('base64'),
189190
type: responseOfRetry.headers()['content-type']
190191
}
191192
route.fulfill({
192193
status: responseOfRetry.status(),
193194
headers: responseOfRetry.headers(),
194-
body: body,
195+
body: bodyOfRetry,
195196
});
196197
} else {
197198
ctx.log.debug(`Resource had a disallowed status for retry as well ${requestUrl} disallowed status [${responseOfRetry.status()}]`);

0 commit comments

Comments
 (0)