Skip to content

Commit

Permalink
Clear tempBuffer after file processing to ensure the array is no long…
Browse files Browse the repository at this point in the history
…er referenced and can be gc'ed. (#295)
  • Loading branch information
ludeknovy authored Feb 15, 2024
1 parent 71a0ec2 commit 1a8f86b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/server/controllers/item/create-item-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const createItemController = (req: IGetUserAuthInfoRequest, res: Response
removeUploadedFile(kpiFilename)
// eslint-disable-next-line max-len
logger.info(`Parsed ${rowCount} records in ${(Date.now() - parsingStart) / SECONDS_DIVISOR} seconds`)
tempBuffer = null
await itemDataProcessing({
itemId,
projectName, scenarioName,
Expand All @@ -170,6 +171,7 @@ export const createItemController = (req: IGetUserAuthInfoRequest, res: Response
})
.on("error", async (processingError) => {
logger.info(`File processing was aborted because of an error, item_id: ${itemId}`)
tempBuffer = null
await handleError(itemId, kpiFilename, processingError)
})
} catch(e) {
Expand Down

0 comments on commit 1a8f86b

Please sign in to comment.