Skip to content

Commit

Permalink
chore(backend): ノートを受信した際に遅延時間をログ出力するように
Browse files Browse the repository at this point in the history
  • Loading branch information
4ster1sk committed Dec 27, 2024
1 parent 92e03ca commit da6a093
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/backend/src/core/activitypub/ApInboxService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ export class ApInboxService {
return 'skip: malformed createdAt';
}

if (createdAt) {
const delay = Date.now() - createdAt.getTime();
this.logger.info(`Note Received delay: ${delay}ms, host: ${actor.host}`);
}

await this.noteCreateService.create(actor, {
createdAt,
renote,
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/core/activitypub/models/ApNoteService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ export class ApNoteService {

const apEmojis = emojis.map(emoji => emoji.name);

const createdAt = note.published ? new Date(note.published) : null;
if (createdAt) {
const delay = Date.now() - createdAt.getTime();
this.logger.info(`Note Received delay: ${delay}ms, host: ${actor.host}`);
}

try {
return await this.noteCreateService.create(actor, {
createdAt: note.published ? new Date(note.published) : null,
Expand Down

0 comments on commit da6a093

Please sign in to comment.