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) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user