diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-05-22 09:40:30 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-06-06 22:20:16 -0400 |
| commit | 53fbe87ff22add20ebe43b9c269a410d7a6ea64c (patch) | |
| tree | 9aa9d08b868ac39e259159f8bb61c4e3d711c925 /packages | |
| parent | reduce log spam from FileInfoService (diff) | |
| download | sharkey-53fbe87ff22add20ebe43b9c269a410d7a6ea64c.tar.gz sharkey-53fbe87ff22add20ebe43b9c269a410d7a6ea64c.tar.bz2 sharkey-53fbe87ff22add20ebe43b9c269a410d7a6ea64c.zip | |
reduce log spam from ApDbResolverService.refetchPublicKeyForApId
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/backend/src/core/activitypub/ApDbResolverService.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/packages/backend/src/core/activitypub/ApDbResolverService.ts b/packages/backend/src/core/activitypub/ApDbResolverService.ts index d8aa80f5b7..e9e0dde9cd 100644 --- a/packages/backend/src/core/activitypub/ApDbResolverService.ts +++ b/packages/backend/src/core/activitypub/ApDbResolverService.ts @@ -165,18 +165,23 @@ export class ApDbResolverService implements OnApplicationShutdown { */ @bindThis public async refetchPublicKeyForApId(user: MiRemoteUser): Promise<MiUserPublickey | null> { - this.apLoggerService.logger.debug('Re-fetching public key for user', { userId: user.id, uri: user.uri }); - await this.apPersonService.updatePerson(user.uri); + this.apLoggerService.logger.debug(`Updating public key for user ${user.id} (${user.uri})`); - const key = await this.apPersonService.findPublicKeyByUserId(user.id); + const oldKey = await this.apPersonService.findPublicKeyByUserId(user.id); + await this.apPersonService.updatePerson(user.uri); + const newKey = await this.apPersonService.findPublicKeyByUserId(user.id); - if (key) { - this.apLoggerService.logger.info('Re-fetched public key for user', { userId: user.id, uri: user.uri }); + if (newKey) { + if (oldKey && newKey.keyPem === oldKey.keyPem) { + this.apLoggerService.logger.debug(`Public key is up-to-date for user ${user.id} (${user.uri})`); + } else { + this.apLoggerService.logger.info(`Updated public key for user ${user.id} (${user.uri})`); + } } else { - this.apLoggerService.logger.warn('Failed to re-fetch key for user', { userId: user.id, uri: user.uri }); + this.apLoggerService.logger.warn(`Failed to update public key for user ${user.id} (${user.uri})`); } - return key; + return newKey ?? oldKey; } @bindThis |