From 2cd7557beaf723fbeed187fcb965859d91de3439 Mon Sep 17 00:00:00 2001 From: Abhinav Gautam Date: Mon, 8 Apr 2024 18:52:03 +0530 Subject: [PATCH] new line --- src/utils/queue-batch-processor.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/utils/queue-batch-processor.ts b/src/utils/queue-batch-processor.ts index 24d3a59..d05e246 100644 --- a/src/utils/queue-batch-processor.ts +++ b/src/utils/queue-batch-processor.ts @@ -3,13 +3,15 @@ import Logstash from "./logstash"; export default async (queue: Queue, logstash: Logstash) => { const jobs = await queue.getJobs(undefined, 0, -1, true); - let jobData = []; + let jobData = ""; for (let job of jobs) { - jobData.push(job.data); + jobData = jobData + JSON.stringify(job.data) + "\r\n"; + } + if (jobData.length > 0) { + logstash.log(jobData, async () => { + for (let job of jobs) { + await job.remove(); + } + }); } - logstash.log(JSON.stringify(jobData), async () => { - for (let job of jobs) { - await job.remove(); - } - }); };