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

@ -1,11 +1,11 @@
import type httpSignature from "@peertube/http-signature";
import { v4 as uuid } from "uuid";
import {v4 as uuid} from "uuid";
import config from "@/config/index.js";
import type { DriveFile } from "@/models/entities/drive-file.js";
import type { IActivity } from "@/remote/activitypub/type.js";
import type { Webhook, webhookEventTypes } from "@/models/entities/webhook.js";
import { envOption } from "../env.js";
import type {DriveFile} from "@/models/entities/drive-file.js";
import type {IActivity} from "@/remote/activitypub/type.js";
import type {Webhook, webhookEventTypes} from "@/models/entities/webhook.js";
import {envOption} from "../env.js";
import processDeliver from "./processors/deliver.js";
import processInbox from "./processors/inbox.js";
@ -14,20 +14,21 @@ import processObjectStorage from "./processors/object-storage/index.js";
import processSystemQueue from "./processors/system/index.js";
import processWebhookDeliver from "./processors/webhook-deliver.js";
import processBackground from "./processors/background/index.js";
import { endedPollNotification } from "./processors/ended-poll-notification.js";
import { queueLogger } from "./logger.js";
import { getJobInfo } from "./get-job-info.js";
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 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