Drop invalid jobs
ci/woodpecker/tag/ociImageTag Pipeline was successful
Details
ci/woodpecker/tag/ociImageTag Pipeline was successful
Details
This commit is contained in:
parent
21a6d3b979
commit
da04190d47
|
@ -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",
|
||||||
},
|
},
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue