Skip to content

Commit ade46f0

Browse files
committed
Logging for followers dispatcher
1 parent c0faba4 commit ade46f0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Diff for: src/federation/index.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ federation
173173
];
174174
});
175175

176+
const followersLogger = getLogger(["hollo", "federation", "followers"]);
177+
176178
federation
177179
.setFollowersDispatcher(
178180
"/@{identifier}/followers",
@@ -181,6 +183,10 @@ federation
181183
where: eq(accountOwners.handle, identifier),
182184
});
183185
if (owner == null) return null;
186+
followersLogger.debug(
187+
"Gathering followers for {identifier} with cursor {cursor} and filter {filter}...",
188+
{ identifier, cursor, filter },
189+
);
184190
const offset = cursor == null ? undefined : Number.parseInt(cursor);
185191
if (offset != null && !Number.isInteger(offset)) return null;
186192
const followers = await db.query.accounts.findMany({
@@ -206,7 +212,7 @@ federation
206212
limit: offset == null ? undefined : 41,
207213
});
208214
const items = offset == null ? followers : followers.slice(0, 40);
209-
return {
215+
const result = {
210216
items: items.map((f) => ({
211217
id: new URL(f.iri),
212218
inboxId: new URL(f.inboxUrl),
@@ -217,6 +223,11 @@ federation
217223
nextCursor:
218224
offset != null && followers.length > 40 ? `${offset + 40}` : null,
219225
};
226+
followersLogger.debug(
227+
"Gathered {followers} followers for {identifier} with cursor {cursor} and filter {filter}.",
228+
{ followers: result.items.length, identifier, cursor, filter },
229+
);
230+
return result;
220231
},
221232
)
222233
.setFirstCursor(async (_ctx, _identifier) => "0")
@@ -421,7 +432,7 @@ federation.setFeaturedTagsDispatcher(
421432
},
422433
);
423434

424-
const inboxLogger = getLogger(["hollo", "inbox"]);
435+
const inboxLogger = getLogger(["hollo", "federation", "inbox"]);
425436

426437
federation
427438
.setInboxListeners("/@{identifier}/inbox", "/inbox")

0 commit comments

Comments
 (0)