Sharkey/src/queue/processors/db/index.ts

28 lines
905 B
TypeScript
Raw Normal View History

2019-03-07 16:07:21 +02:00
import * as Bull from 'bull';
import { DbJobData } from '@/queue/types.js';
import { deleteDriveFiles } from './delete-drive-files.js';
import { exportNotes } from './export-notes.js';
import { exportFollowing } from './export-following.js';
import { exportMute } from './export-mute.js';
import { exportBlocking } from './export-blocking.js';
import { exportUserLists } from './export-user-lists.js';
import { importFollowing } from './import-following.js';
import { importUserLists } from './import-user-lists.js';
2018-03-31 13:55:00 +03:00
2019-03-07 16:07:21 +02:00
const jobs = {
2019-02-20 18:30:21 +02:00
deleteDriveFiles,
exportNotes,
2019-02-06 13:56:48 +02:00
exportFollowing,
exportMute,
exportBlocking,
2019-03-11 12:43:58 +02:00
exportUserLists,
2019-03-11 17:34:19 +02:00
importFollowing,
2019-03-11 12:43:58 +02:00
importUserLists
2021-05-08 12:56:21 +03:00
} as Record<string, Bull.ProcessCallbackFunction<DbJobData> | Bull.ProcessPromiseFunction<DbJobData>>;
2018-03-31 13:55:00 +03:00
2021-05-08 12:56:21 +03:00
export default function(dbQueue: Bull.Queue<DbJobData>) {
2019-03-07 16:27:38 +02:00
for (const [k, v] of Object.entries(jobs)) {
2021-05-08 12:56:21 +03:00
dbQueue.process(k, v);
2019-03-07 16:27:38 +02:00
}
2019-03-07 16:07:21 +02:00
}