refresh
This commit is contained in:
parent
13e0a64a77
commit
e2a8f4f880
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js';
|
||||
import type { MiUser, NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { MemoryKVCache } from '@/misc/cache.js';
|
||||
import type { MiUserPublickey } from '@/models/UserPublickey.js';
|
||||
|
@ -190,6 +190,16 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
|||
};
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public refreshCacheByUserId(userId: MiUser['id']): void {
|
||||
this.publicKeyByUserIdCache.delete(userId);
|
||||
for (const [k, v] of this.publicKeyCache.cache.entries()) {
|
||||
if (v.value?.userId === userId) {
|
||||
this.publicKeyCache.delete(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public dispose(): void {
|
||||
this.publicKeyCache.dispose();
|
||||
|
|
|
@ -119,7 +119,8 @@ export class InboxProcessorService {
|
|||
// みたいになっててUserを引っ張れば公開キーも入ることを期待する
|
||||
if (activity.signature.creator) {
|
||||
const candicate = activity.signature.creator.replace(/#.*/, '');
|
||||
await this.apPersonService.resolvePerson(candicate).catch(() => null);
|
||||
const user = await this.apPersonService.resolvePerson(candicate).catch(() => null);
|
||||
if (user) this.apDbResolverService.refreshCacheByUserId(user.id);
|
||||
}
|
||||
|
||||
// keyIdからLD-Signatureのユーザーを取得
|
||||
|
|
Loading…
Reference in New Issue