mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
reduce log spam from ApDbResolverService.refetchPublicKeyForApId
This commit is contained in:
parent
2863f343f8
commit
53fbe87ff2
1 changed files with 12 additions and 7 deletions
|
@ -165,18 +165,23 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async refetchPublicKeyForApId(user: MiRemoteUser): Promise<MiUserPublickey | null> {
|
public async refetchPublicKeyForApId(user: MiRemoteUser): Promise<MiUserPublickey | null> {
|
||||||
this.apLoggerService.logger.debug('Re-fetching public key for user', { userId: user.id, uri: user.uri });
|
this.apLoggerService.logger.debug(`Updating public key for user ${user.id} (${user.uri})`);
|
||||||
|
|
||||||
|
const oldKey = await this.apPersonService.findPublicKeyByUserId(user.id);
|
||||||
await this.apPersonService.updatePerson(user.uri);
|
await this.apPersonService.updatePerson(user.uri);
|
||||||
|
const newKey = await this.apPersonService.findPublicKeyByUserId(user.id);
|
||||||
|
|
||||||
const key = await this.apPersonService.findPublicKeyByUserId(user.id);
|
if (newKey) {
|
||||||
|
if (oldKey && newKey.keyPem === oldKey.keyPem) {
|
||||||
if (key) {
|
this.apLoggerService.logger.debug(`Public key is up-to-date for user ${user.id} (${user.uri})`);
|
||||||
this.apLoggerService.logger.info('Re-fetched public key for user', { userId: user.id, uri: user.uri });
|
|
||||||
} else {
|
} else {
|
||||||
this.apLoggerService.logger.warn('Failed to re-fetch key for user', { userId: user.id, uri: user.uri });
|
this.apLoggerService.logger.info(`Updated public key for user ${user.id} (${user.uri})`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.apLoggerService.logger.warn(`Failed to update public key for user ${user.id} (${user.uri})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return key;
|
return newKey ?? oldKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
Loading…
Add table
Reference in a new issue