소스 검색

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,
         };
     }