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) {
const data = {
type: 'deleteNotes',
return dbQueue.add('deleteNotes', {
user: user
};
return dbQueue.add(data, {
}, {
removeOnComplete: true,
removeOnFail: true
});
}
export function createDeleteDriveFilesJob(user: ILocalUser) {
const data = {
type: 'deleteDriveFiles',
return dbQueue.add('deleteDriveFiles', {
user: user
};
return dbQueue.add(data, {
}, {
removeOnComplete: true,
removeOnFail: true
});
}
export function createExportNotesJob(user: ILocalUser) {
const data = {
type: 'exportNotes',
return dbQueue.add('exportNotes', {
user: user
};
return dbQueue.add(data, {
}, {
removeOnComplete: true,
removeOnFail: true
});
}
export function createExportFollowingJob(user: ILocalUser) {
const data = {
type: 'exportFollowing',
return dbQueue.add('exportFollowing', {
user: user
};
return dbQueue.add(data, {
}, {
removeOnComplete: true,
removeOnFail: true
});
}
export function createExportMuteJob(user: ILocalUser) {
const data = {
type: 'exportMute',
return dbQueue.add('exportMute', {
user: user
};
return dbQueue.add(data, {
}, {
removeOnComplete: true,
removeOnFail: true
});
}
export function createExportBlockingJob(user: ILocalUser) {
const data = {
type: 'exportBlocking',
return dbQueue.add('exportBlocking', {
user: user
};
return dbQueue.add(data, {
}, {
removeOnComplete: true,
removeOnFail: true
});
@ -137,7 +119,7 @@ export default function() {
if (!program.onlyServer) {
deliverQueue.process(processDeliver);
inboxQueue.process(processInbox);
dbQueue.process(processDb);
processDb(dbQueue);
}
}

View file

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