Refactor
This commit is contained in:
parent
d1aea7596c
commit
d283ec69f7
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue