Răsfoiți Sursa

perf(core): Optimize payload size for buffered jobs in DB

Previously, job data was getting duplicated inside the payload object.
This change cuts DB storage usage to half of the previous level.
Michael Bromley 11 luni în urmă
părinte
comite
f81a908eb5

+ 10 - 1
packages/core/src/plugin/default-job-queue-plugin/sql-job-buffer-storage-strategy.ts

@@ -73,8 +73,17 @@ export class SqlJobBufferStorageStrategy implements JobBufferStorageStrategy {
 
 
     private toJobConfig(job: Job<any>): JobConfig<any> {
     private toJobConfig(job: Job<any>): JobConfig<any> {
         return {
         return {
-            ...job,
+            queueName: job.queueName,
             data: job.data,
             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,
             id: job.id ?? undefined,
         };
         };
     }
     }