mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-16 23:17:33 -07:00
Refactor
This commit is contained in:
parent
e9e06118ac
commit
edb1db8761
2 changed files with 17 additions and 33 deletions
|
@ -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 a new issue