Skip to content

Commit

Permalink
Merge pull request #3736 from Tangerine-Community/larger-csv-exports-…
Browse files Browse the repository at this point in the history
…buffer-mod

Larger csv exports buffer modification
  • Loading branch information
esurface authored Nov 18, 2024
2 parents 12c8e05 + f84315d commit 01d90c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function generateCsv(dbName, formId, outputPath, year = '*', month = '*', csvTem
}
cmd = `${cmd} ${csvTemplate ? `"${csvTemplate.headers.join(',')}"` : ''}`
log.debug("generate-csv: " + cmd)
exec(cmd).then(status => {
const maxBuffer = 1024 * 1024 * 100;
exec(cmd, { maxBuffer }).then(status => {
resolve(status)
}).catch(error => {
log.error("Error when exec-ing generate-csv: " + error)
Expand Down
4 changes: 3 additions & 1 deletion server/src/scripts/generate-csv/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ async function go(state) {
// Run batches.
while (state.complete === false) {
log.debug(`Run batch at skip of ${state.skip} at statePath: ${state.statePath}`)
const response = await exec(`./batch.js '${state.statePath}'`)
const maxBuffer = 1024 * 1024 * 100; // 100MB
const response = await exec(`./batch.js '${state.statePath}'`, { maxBuffer });

if (response.stderr) console.error(response.stderr)
if (process.env.NODE_ENV === 'development') console.log(response)
state = JSON.parse(await readFile(state.statePath))
Expand Down

0 comments on commit 01d90c9

Please sign in to comment.