From 591a5c277cdf197f043e5b24743dbdb346e65c4f Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sat, 8 May 2021 18:56:21 +0900 Subject: Add queue types (#7504) --- src/queue/processors/object-storage/clean-remote-files.ts | 2 +- src/queue/processors/object-storage/delete-file.ts | 3 ++- src/queue/processors/object-storage/index.ts | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/queue/processors/object-storage') diff --git a/src/queue/processors/object-storage/clean-remote-files.ts b/src/queue/processors/object-storage/clean-remote-files.ts index 7b34892e1f..a922755f4d 100644 --- a/src/queue/processors/object-storage/clean-remote-files.ts +++ b/src/queue/processors/object-storage/clean-remote-files.ts @@ -7,7 +7,7 @@ import { MoreThan, Not, IsNull } from 'typeorm'; const logger = queueLogger.createSubLogger('clean-remote-files'); -export default async function cleanRemoteFiles(job: Bull.Job, done: any): Promise { +export default async function cleanRemoteFiles(job: Bull.Job<{}>, done: any): Promise { logger.info(`Deleting cached remote files...`); let deletedCount = 0; diff --git a/src/queue/processors/object-storage/delete-file.ts b/src/queue/processors/object-storage/delete-file.ts index f899df7d2e..31050998af 100644 --- a/src/queue/processors/object-storage/delete-file.ts +++ b/src/queue/processors/object-storage/delete-file.ts @@ -1,7 +1,8 @@ +import { ObjectStorageFileJobData } from '@/queue/types'; import * as Bull from 'bull'; import { deleteObjectStorageFile } from '../../../services/drive/delete-file'; -export default async (job: Bull.Job) => { +export default async (job: Bull.Job) => { const key: string = job.data.key; await deleteObjectStorageFile(key); diff --git a/src/queue/processors/object-storage/index.ts b/src/queue/processors/object-storage/index.ts index 33ef665b38..0d9570e179 100644 --- a/src/queue/processors/object-storage/index.ts +++ b/src/queue/processors/object-storage/index.ts @@ -1,14 +1,15 @@ import * as Bull from 'bull'; +import { ObjectStorageJobData } from '@/queue/types'; import deleteFile from './delete-file'; import cleanRemoteFiles from './clean-remote-files'; const jobs = { deleteFile, cleanRemoteFiles, -} as any; +} as Record | Bull.ProcessPromiseFunction>; export default function(q: Bull.Queue) { for (const [k, v] of Object.entries(jobs)) { - q.process(k, 16, v as any); + q.process(k, 16, v); } } -- cgit v1.2.3-freya