From 5a3d8eb67571cc68041b2b9811a215c530215483 Mon Sep 17 00:00:00 2001 From: Trevor Richards Date: Thu, 10 Oct 2024 09:57:05 -0700 Subject: [PATCH 1/2] fix: race condition to restart printPdf --- backend/src/components/application.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/components/application.js b/backend/src/components/application.js index 416863c0..7a80c0c4 100644 --- a/backend/src/components/application.js +++ b/backend/src/components/application.js @@ -504,11 +504,13 @@ async function printPdf(req, numOfRetries = 0) { await postChangeRequestSummaryDocument(payload); } - + browser.close(); return payload; } catch (e) { log.error(e); + if (browser.process() !== null) { await browser.close(); } + if (numOfRetries >= 3) { log.info('printPdf :: maximum number of retries reached'); log.error(`printPdf :: unable to save pdf for application id ${req.params.applicationId}`); @@ -519,8 +521,6 @@ async function printPdf(req, numOfRetries = 0) { log.info(`printPdf :: retry count ${retryCount}`); await printPdf(req, retryCount); } - } finally { - await browser.close(); } } From 12265fec066adc5461310ef981d1ca840e2184a0 Mon Sep 17 00:00:00 2001 From: Trevor Richards Date: Thu, 10 Oct 2024 09:57:54 -0700 Subject: [PATCH 2/2] feat: update node/chromium versions --- backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 626463b7..2b50d4d1 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM artifacts.developer.gov.bc.ca/docker-remote/node:16.20.0-alpine3.18 +FROM artifacts.developer.gov.bc.ca/docker-remote/node:20.18.0-alpine3.20 ENV NPM_CONFIG_CACHE /tmp/npm RUN mkdir -p /logs \