normalize re-fetch logic between InboxProcessorService and ActivityPubServerService

This commit is contained in:
Hazelnoot 2024-10-15 13:49:51 -04:00
parent c0a5955e0a
commit 27b502fab5
3 changed files with 10 additions and 6 deletions

View file

@ -176,10 +176,17 @@ export class ApDbResolverService implements OnApplicationShutdown {
*/
@bindThis
public async refetchPublicKeyForApId(user: MiRemoteUser): Promise<MiUserPublickey | null> {
this.apLoggerService.logger.info('Re-fetching public key for user', { userId: user.id });
this.apLoggerService.logger.debug('Re-fetching public key for user', { userId: user.id, uri: user.uri });
await this.apPersonService.updatePerson(user.uri);
const key = await this.userPublickeysRepository.findOneBy({ userId: user.id });
this.publicKeyByUserIdCache.set(user.id, key);
if (key) {
this.apLoggerService.logger.info('Re-fetched public key for user', { userId: user.id, uri: user.uri });
} else {
this.apLoggerService.logger.warn('Failed to re-fetch key for user', { userId: user.id, uri: user.uri });
}
return key;
}