diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index 1dfad2541f..e8c66683cc 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -5,7 +5,7 @@ import type { User } from '@/models/entities/User.js'; type NoteLike = { userId: Note['userId']; text: Note['text']; - cw: Note['cw']; + cw?: Note['cw']; }; type UserLike = { diff --git a/packages/backend/src/queue/DbQueueProcessorsService.ts b/packages/backend/src/queue/DbQueueProcessorsService.ts index f79100e6ce..58384c4d1b 100644 --- a/packages/backend/src/queue/DbQueueProcessorsService.ts +++ b/packages/backend/src/queue/DbQueueProcessorsService.ts @@ -39,25 +39,19 @@ export class DbQueueProcessorsService { ) { } - public start(dbQueue: Bull.Queue) { - const jobs = { - deleteDriveFiles: (job, done) => this.deleteDriveFilesProcessorService.process(job, done), - exportCustomEmojis: (job, done) => this.exportCustomEmojisProcessorService.process(job, done), - exportNotes: (job, done) => this.exportNotesProcessorService.process(job, done), - exportFollowing: (job, done) => this.exportFollowingProcessorService.process(job, done), - exportMuting: (job, done) => this.exportMutingProcessorService.process(job, done), - exportBlocking: (job, done) => this.exportBlockingProcessorService.process(job, done), - exportUserLists: (job, done) => this.exportUserListsProcessorService.process(job, done), - importFollowing: (job, done) => this.importFollowingProcessorService.process(job, done), - importMuting: (job, done) => this.importMutingProcessorService.process(job, done), - importBlocking: (job, done) => this.importBlockingProcessorService.process(job, done), - importUserLists: (job, done) => this.importUserListsProcessorService.process(job, done), - importCustomEmojis: (job, done) => this.importCustomEmojisProcessorService.process(job, done), - deleteAccount: (job) => this.deleteAccountProcessorService.process(job), - } as Record>>; - - for (const [k, v] of Object.entries(jobs)) { - dbQueue.process(k, v); - } + public start(q: Bull.Queue): void { + q.process('deleteDriveFiles', (job, done) => this.deleteDriveFilesProcessorService.process(job, done)); + q.process('exportCustomEmojis', (job, done) => this.exportCustomEmojisProcessorService.process(job, done)); + q.process('exportNotes', (job, done) => this.exportNotesProcessorService.process(job, done)); + q.process('exportFollowing', (job, done) => this.exportFollowingProcessorService.process(job, done)); + q.process('exportMuting', (job, done) => this.exportMutingProcessorService.process(job, done)); + q.process('exportBlocking', (job, done) => this.exportBlockingProcessorService.process(job, done)); + q.process('exportUserLists', (job, done) => this.exportUserListsProcessorService.process(job, done)); + q.process('importFollowing', (job, done) => this.importFollowingProcessorService.process(job, done)); + q.process('importMuting', (job, done) => this.importMutingProcessorService.process(job, done)); + q.process('importBlocking', (job, done) => this.importBlockingProcessorService.process(job, done)); + q.process('importUserLists', (job, done) => this.importUserListsProcessorService.process(job, done)); + q.process('importCustomEmojis', (job, done) => this.importCustomEmojisProcessorService.process(job, done)); + q.process('deleteAccount', (job) => this.deleteAccountProcessorService.process(job)); } } diff --git a/packages/backend/src/queue/ObjectStorageQueueProcessorsService.ts b/packages/backend/src/queue/ObjectStorageQueueProcessorsService.ts index 097e4448a5..3ff3dd090c 100644 --- a/packages/backend/src/queue/ObjectStorageQueueProcessorsService.ts +++ b/packages/backend/src/queue/ObjectStorageQueueProcessorsService.ts @@ -17,14 +17,8 @@ export class ObjectStorageQueueProcessorsService { ) { } - public start(q: Bull.Queue) { - const jobs = { - deleteFile: (job) => this.deleteFileProcessorService.process(job), - cleanRemoteFiles: (job, done) => this.cleanRemoteFilesProcessorService.process(job, done), - } as Record>>; - - for (const [k, v] of Object.entries(jobs)) { - q.process(k, 16, v); - } + public start(q: Bull.Queue): void { + q.process('deleteFile', 16, (job) => this.deleteFileProcessorService.process(job)); + q.process('cleanRemoteFiles', 16, (job, done) => this.cleanRemoteFilesProcessorService.process(job, done)); } } diff --git a/packages/backend/src/queue/SystemQueueProcessorsService.ts b/packages/backend/src/queue/SystemQueueProcessorsService.ts index ccb040fae5..a8af92b9ba 100644 --- a/packages/backend/src/queue/SystemQueueProcessorsService.ts +++ b/packages/backend/src/queue/SystemQueueProcessorsService.ts @@ -22,17 +22,11 @@ export class SystemQueueProcessorsService { ) { } - public start(dbQueue: Bull.Queue>) { - const jobs = { - tickCharts: (job, done) => this.tickChartsProcessorService.process(job, done), - resyncCharts: (job, done) => this.resyncChartsProcessorService.process(job, done), - cleanCharts: (job, done) => this.cleanChartsProcessorService.process(job, done), - checkExpiredMutings: (job, done) => this.checkExpiredMutingsProcessorService.process(job, done), - clean: (job, done) => this.cleanProcessorService.process(job, done), - } as Record> | Bull.ProcessPromiseFunction>>; - - for (const [k, v] of Object.entries(jobs)) { - dbQueue.process(k, v); - } + public start(q: Bull.Queue): void { + q.process('tickCharts', (job, done) => this.tickChartsProcessorService.process(job, done)); + q.process('resyncCharts', (job, done) => this.resyncChartsProcessorService.process(job, done)); + q.process('cleanCharts', (job, done) => this.cleanChartsProcessorService.process(job, done)); + q.process('checkExpiredMutings', (job, done) => this.checkExpiredMutingsProcessorService.process(job, done)); + q.process('clean', (job, done) => this.cleanProcessorService.process(job, done)); } }