refactor(federation): 🔊 Add more logging to some federation logic

This commit is contained in:
Jesse Wierzbinski 2024-11-24 22:01:14 +01:00
parent ef0cca671a
commit b333ecc816
No known key found for this signature in database
2 changed files with 17 additions and 0 deletions

View file

@ -3,6 +3,7 @@ import type { Entity } from "@versia/federation/types";
import { Instance, Note, User } from "@versia/kit/db";
import { Queue, Worker } from "bullmq";
import type { SocketAddress } from "bun";
import chalk from "chalk";
import IORedis from "ioredis";
import { InboxProcessor } from "./classes/inbox/processor.ts";
import { config } from "./packages/config-manager/index.ts";
@ -98,6 +99,12 @@ export const inboxWorker = new Worker<InboxJobData, Response, InboxJobType>(
const logger = getLogger(["federation", "inbox"]);
logger.debug(
`Processing entity ${chalk.bold(
data.id,
)} from ${chalk.bold(signedBy)}`,
);
if (authorization) {
const processor = new InboxProcessor(
request,
@ -112,6 +119,12 @@ export const inboxWorker = new Worker<InboxJobData, Response, InboxJobType>(
ip,
);
logger.debug(
`Entity ${chalk.bold(
data.id,
)} is potentially from a bridge`,
);
return await processor.process();
}