Drop invalid jobs
ci/woodpecker/tag/ociImageTag Pipeline was successful Details

This commit is contained in:
Natty 2024-01-08 03:32:05 +01:00
parent 21a6d3b979
commit da04190d47
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 4 additions and 12 deletions

View File

@ -28,7 +28,6 @@ import {
webhookDeliverQueue, webhookDeliverQueue,
} from "./queues.js"; } from "./queues.js";
import type {ThinUser} from "./types.js"; import type {ThinUser} from "./types.js";
import {URL} from "node:url";
function renderError(e: Error): any { function renderError(e: Error): any {
return { return {
@ -170,16 +169,9 @@ export function deliver(user: ThinUser, content: unknown, to: string | null) {
to, to,
}; };
try {
new URL(data.to);
} catch (e) {
deliverLogger.error(`Failed URL parse, incorrect data: ${JSON.stringify(data)}`);
return null;
}
return deliverQueue.add(data, { return deliverQueue.add(data, {
attempts: config.deliverJobMaxAttempts || 12, attempts: config.deliverJobMaxAttempts || 12,
timeout: 1 * 60 * 1000, // 1min timeout: 60 * 1000, // 1min
backoff: { backoff: {
type: "apBackoff", type: "apBackoff",
}, },

View File

@ -20,9 +20,9 @@ export default async (job: Bull.Job<DeliverJobData>) => {
try { try {
host = new URL(job.data.to).host; host = new URL(job.data.to).host;
} catch (e) { } catch (e) {
logger.error(`${e}`); logger.error(`Invalid URL: ${e}`);
logger.error(`Failed URL parse: ${job}`); await job.discard();
return null; throw e;
} }
const puny = toPuny(host); const puny = toPuny(host);