Преглед изворни кода

perf(job-queue-plugin): Optimize payload size for buffered jobs in Redis

Previously, job data was getting duplicated inside the payload object.
This change cuts memory usage to half of the previous level.
Michael Bromley пре 11 месеци
родитељ
комит
7c72352c60

+ 10 - 1
packages/job-queue-plugin/src/bullmq/redis-job-buffer-storage-strategy.ts

@@ -54,8 +54,17 @@ export class RedisJobBufferStorageStrategy implements JobBufferStorageStrategy {
 
     private toJobConfigString(job: Job<any>): string {
         const jobConfig: JobConfig<any> = {
-            ...job,
+            queueName: job.queueName,
             data: job.data,
+            retries: job.retries,
+            attempts: job.attempts,
+            state: job.state,
+            progress: job.progress,
+            result: job.result,
+            error: job.error,
+            createdAt: job.createdAt,
+            startedAt: job.startedAt,
+            settledAt: job.settledAt,
             id: job.id ?? undefined,
         };
         return JSON.stringify(jobConfig);