mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-23 18:37:30 -07:00
[backend] Set opts.removeOnComplete when discarding corrupt jobs (since the opts object is likely also corrupted)
This commit is contained in:
parent
0d5220e505
commit
cc9bc79466
5 changed files with 16 additions and 4 deletions
|
@ -20,7 +20,10 @@ const logger = new Logger("deliver");
|
|||
let latest: string | null = null;
|
||||
|
||||
export default async (job: Bull.Job<DeliverJobData>) => {
|
||||
if (job.data == null || Object.keys(job.data).length === 0) return "Skip (data was null or empty)";
|
||||
if (job.data == null || Object.keys(job.data).length === 0) {
|
||||
job.opts.removeOnComplete = true;
|
||||
return "Skip (data was null or empty)";
|
||||
}
|
||||
const { host } = new URL(job.data.to);
|
||||
const puny = toPuny(host);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ export async function endedPollNotification(
|
|||
done: any,
|
||||
): Promise<void> {
|
||||
if (job.data == null || Object.keys(job.data).length === 0) {
|
||||
job.opts.removeOnComplete = true;
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,10 @@ const logger = new Logger("inbox");
|
|||
|
||||
// Processing when an activity arrives in the user's inbox
|
||||
export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
||||
if (job.data == null || Object.keys(job.data).length === 0) return "Skip (data was null or empty)";
|
||||
if (job.data == null || Object.keys(job.data).length === 0) {
|
||||
job.opts.removeOnComplete = true;
|
||||
return "Skip (data was null or empty)";
|
||||
}
|
||||
const signature = job.data.signature; // HTTP-signature
|
||||
let activity = job.data.activity;
|
||||
|
||||
|
|
|
@ -2,4 +2,6 @@ import Bull from "bull";
|
|||
|
||||
// Processor to be registered for jobs with __default__ (unnamed) handlers in queues that only have named handlers
|
||||
// Prevents sporadic bogus jobs from clogging up the queues
|
||||
export async function noop(_: Bull.Job): Promise<void> { }
|
||||
export async function noop(job: Bull.Job): Promise<void> {
|
||||
job.opts.removeOnComplete = true;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,10 @@ import config from "@/config/index.js";
|
|||
const logger = new Logger("webhook");
|
||||
|
||||
export default async (job: Bull.Job<WebhookDeliverJobData>) => {
|
||||
if (job.data == null || Object.keys(job.data).length === 0) return "Skip (data was null or empty)";
|
||||
if (job.data == null || Object.keys(job.data).length === 0) {
|
||||
job.opts.removeOnComplete = true;
|
||||
return "Skip (data was null or empty)";
|
||||
}
|
||||
try {
|
||||
logger.debug(`delivering ${job.data.webhookId}`);
|
||||
|
||||
|
|
Loading…
Reference in a new issue