misskey/src/queue/processors/index.ts

32 lines
779 B
TypeScript
Raw Normal View History

import deliver from './http/deliver';
import processInbox from './http/process-inbox';
2019-02-21 01:30:21 +09:00
import { deleteNotes } from './delete-notes';
import { deleteDriveFiles } from './delete-drive-files';
import { exportNotes } from './export-notes';
2019-02-06 20:56:48 +09:00
import { exportFollowing } from './export-following';
import { exportMute } from './export-mute';
import { exportBlocking } from './export-blocking';
import { queueLogger } from '../logger';
2018-03-31 19:55:00 +09:00
2018-06-18 14:28:43 +09:00
const handlers: any = {
2018-04-07 15:45:03 +09:00
deliver,
processInbox,
2019-02-21 01:30:21 +09:00
deleteNotes,
deleteDriveFiles,
exportNotes,
2019-02-06 20:56:48 +09:00
exportFollowing,
exportMute,
exportBlocking,
2018-03-31 19:55:00 +09:00
};
2018-06-18 14:28:43 +09:00
export default (job: any, done: any) => {
2018-04-07 15:45:03 +09:00
const handler = handlers[job.data.type];
if (handler) {
handler(job, done);
} else {
queueLogger.error(`Unknown job: ${job.data.type}`);
2018-04-07 15:45:03 +09:00
done();
}
};