This commit is contained in:
syuilo 2019-03-07 23:27:38 +09:00
parent d1aea7596c
commit d283ec69f7
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 17 additions and 33 deletions

View File

@ -62,72 +62,54 @@ export function inbox(activity: any, signature: httpSignature.IParsedSignature)
} }
export function createDeleteNotesJob(user: ILocalUser) { export function createDeleteNotesJob(user: ILocalUser) {
const data = { return dbQueue.add('deleteNotes', {
type: 'deleteNotes',
user: user user: user
}; }, {
return dbQueue.add(data, {
removeOnComplete: true, removeOnComplete: true,
removeOnFail: true removeOnFail: true
}); });
} }
export function createDeleteDriveFilesJob(user: ILocalUser) { export function createDeleteDriveFilesJob(user: ILocalUser) {
const data = { return dbQueue.add('deleteDriveFiles', {
type: 'deleteDriveFiles',
user: user user: user
}; }, {
return dbQueue.add(data, {
removeOnComplete: true, removeOnComplete: true,
removeOnFail: true removeOnFail: true
}); });
} }
export function createExportNotesJob(user: ILocalUser) { export function createExportNotesJob(user: ILocalUser) {
const data = { return dbQueue.add('exportNotes', {
type: 'exportNotes',
user: user user: user
}; }, {
return dbQueue.add(data, {
removeOnComplete: true, removeOnComplete: true,
removeOnFail: true removeOnFail: true
}); });
} }
export function createExportFollowingJob(user: ILocalUser) { export function createExportFollowingJob(user: ILocalUser) {
const data = { return dbQueue.add('exportFollowing', {
type: 'exportFollowing',
user: user user: user
}; }, {
return dbQueue.add(data, {
removeOnComplete: true, removeOnComplete: true,
removeOnFail: true removeOnFail: true
}); });
} }
export function createExportMuteJob(user: ILocalUser) { export function createExportMuteJob(user: ILocalUser) {
const data = { return dbQueue.add('exportMute', {
type: 'exportMute',
user: user user: user
}; }, {
return dbQueue.add(data, {
removeOnComplete: true, removeOnComplete: true,
removeOnFail: true removeOnFail: true
}); });
} }
export function createExportBlockingJob(user: ILocalUser) { export function createExportBlockingJob(user: ILocalUser) {
const data = { return dbQueue.add('exportBlocking', {
type: 'exportBlocking',
user: user user: user
}; }, {
return dbQueue.add(data, {
removeOnComplete: true, removeOnComplete: true,
removeOnFail: true removeOnFail: true
}); });
@ -137,7 +119,7 @@ export default function() {
if (!program.onlyServer) { if (!program.onlyServer) {
deliverQueue.process(processDeliver); deliverQueue.process(processDeliver);
inboxQueue.process(processInbox); inboxQueue.process(processInbox);
dbQueue.process(processDb); processDb(dbQueue);
} }
} }

View File

@ -15,6 +15,8 @@ const jobs = {
exportBlocking, exportBlocking,
} as any; } as any;
export default function(job: Bull.Job, done: any) { export default function(dbQueue: Bull.Queue) {
jobs[job.data.type](job, done); for (const [k, v] of Object.entries(jobs)) {
dbQueue.process(k, v as any);
}
} }