リモートユーザーが復活してもキャッシュにより該当ユーザーのActivityが受け入れられないのを修正 Fix #13273
This commit is contained in:
parent
b95e25004f
commit
1150a1a872
|
@ -85,6 +85,7 @@ export class CacheService implements OnApplicationShutdown {
|
||||||
this.uriPersonCache = new MemoryKVCache<MiUser | null, string | null>(Infinity, {
|
this.uriPersonCache = new MemoryKVCache<MiUser | null, string | null>(Infinity, {
|
||||||
toMapConverter: user => {
|
toMapConverter: user => {
|
||||||
if (user === null) return null;
|
if (user === null) return null;
|
||||||
|
if (user.isDeleted) return null;
|
||||||
|
|
||||||
userByIdCache.set(user.id, user);
|
userByIdCache.set(user.id, user);
|
||||||
return user.id;
|
return user.id;
|
||||||
|
|
|
@ -106,12 +106,12 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
|
|
||||||
return await this.cacheService.userByIdCache.fetchMaybe(
|
return await this.cacheService.userByIdCache.fetchMaybe(
|
||||||
parsed.id,
|
parsed.id,
|
||||||
() => this.usersRepository.findOneBy({ id: parsed.id }).then(x => x ?? undefined),
|
() => this.usersRepository.findOneBy({ id: parsed.id, isDeleted: false }).then(x => x ?? undefined),
|
||||||
) as MiLocalUser | undefined ?? null;
|
) as MiLocalUser | undefined ?? null;
|
||||||
} else {
|
} else {
|
||||||
return await this.cacheService.uriPersonCache.fetch(
|
return await this.cacheService.uriPersonCache.fetch(
|
||||||
parsed.uri,
|
parsed.uri,
|
||||||
() => this.usersRepository.findOneBy({ uri: parsed.uri }),
|
() => this.usersRepository.findOneBy({ uri: parsed.uri, isDeleted: false }),
|
||||||
) as MiRemoteUser | null;
|
) as MiRemoteUser | null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,12 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
|
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
|
|
||||||
|
const user = await this.cacheService.findUserById(key.userId).catch(() => null) as MiRemoteUser | null;
|
||||||
|
if (user == null) return null;
|
||||||
|
if (user.isDeleted) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user: await this.cacheService.findUserById(key.userId) as MiRemoteUser,
|
user,
|
||||||
key,
|
key,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -151,6 +155,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
||||||
key: MiUserPublickey | null;
|
key: MiUserPublickey | null;
|
||||||
} | null> {
|
} | null> {
|
||||||
const user = await this.apPersonService.resolvePerson(uri) as MiRemoteUser;
|
const user = await this.apPersonService.resolvePerson(uri) as MiRemoteUser;
|
||||||
|
if (user.isDeleted) return null;
|
||||||
|
|
||||||
const key = await this.publicKeyByUserIdCache.fetch(
|
const key = await this.publicKeyByUserIdCache.fetch(
|
||||||
user.id,
|
user.id,
|
||||||
|
|
|
@ -35,6 +35,7 @@ import { ApResolverService } from './ApResolverService.js';
|
||||||
import { ApAudienceService } from './ApAudienceService.js';
|
import { ApAudienceService } from './ApAudienceService.js';
|
||||||
import { ApPersonService } from './models/ApPersonService.js';
|
import { ApPersonService } from './models/ApPersonService.js';
|
||||||
import { ApQuestionService } from './models/ApQuestionService.js';
|
import { ApQuestionService } from './models/ApQuestionService.js';
|
||||||
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
import type { Resolver } from './ApResolverService.js';
|
import type { Resolver } from './ApResolverService.js';
|
||||||
import type { IAccept, IAdd, IAnnounce, IBlock, ICreate, IDelete, IFlag, IFollow, ILike, IObject, IReject, IRemove, IUndo, IUpdate, IMove } from './type.js';
|
import type { IAccept, IAdd, IAnnounce, IBlock, ICreate, IDelete, IFlag, IFollow, ILike, IObject, IReject, IRemove, IUndo, IUpdate, IMove } from './type.js';
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ export class ApInboxService {
|
||||||
private apPersonService: ApPersonService,
|
private apPersonService: ApPersonService,
|
||||||
private apQuestionService: ApQuestionService,
|
private apQuestionService: ApQuestionService,
|
||||||
private queueService: QueueService,
|
private queueService: QueueService,
|
||||||
|
private cacheService: CacheService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.apLoggerService.logger;
|
this.logger = this.apLoggerService.logger;
|
||||||
}
|
}
|
||||||
|
@ -479,6 +481,9 @@ export class ApInboxService {
|
||||||
isDeleted: true,
|
isDeleted: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.cacheService.uriPersonCache.delete(actor.uri);
|
||||||
|
this.cacheService.userByIdCache.delete(actor.id);
|
||||||
|
|
||||||
return `ok: queued ${job.name} ${job.id}`;
|
return `ok: queued ${job.name} ${job.id}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue