Log invalid deliveries
ci/woodpecker/tag/ociImageTag Pipeline is running Details

This commit is contained in:
Natty 2024-01-08 02:23:25 +01:00
parent e7ff3a81bb
commit 3fe46dc6f9
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 20 additions and 12 deletions

View File

@ -18,16 +18,17 @@ import { endedPollNotification } from "./processors/ended-poll-notification.js";
import {queueLogger} from "./logger.js";
import {getJobInfo} from "./get-job-info.js";
import {
systemQueue,
backgroundQueue,
dbQueue,
deliverQueue,
endedPollNotificationQueue,
inboxQueue,
objectStorageQueue,
endedPollNotificationQueue,
systemQueue,
webhookDeliverQueue,
backgroundQueue,
} from "./queues.js";
import type {ThinUser} from "./types.js";
import {URL} from "node:url";
function renderError(e: Error): any {
return {
@ -169,6 +170,13 @@ export function deliver(user: ThinUser, content: unknown, to: string | null) {
to,
};
try {
new URL(data.to);
} catch (e) {
deliverLogger.error(`Failed URL parse, incorrect data: ${JSON.stringify(data)}`);
return null;
}
return deliverQueue.add(data, {
attempts: config.deliverJobMaxAttempts || 12,
timeout: 1 * 60 * 1000, // 1min