فهرست منبع

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 ماه پیش
والد
کامیت
f81a908eb5
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      packages/core/src/plugin/default-job-queue-plugin/sql-job-buffer-storage-strategy.ts

+ 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> {
         return {
-            ...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,
         };
     }