short cache ttl 12min → 5min
This commit is contained in:
parent
5ccc9d63ed
commit
307e1c4d96
|
@ -14,11 +14,11 @@ import type { MiNote } from '@/models/Note.js';
|
|||
import { bindThis } from '@/decorators.js';
|
||||
import { MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||
import Logger from '@/logger.js';
|
||||
import { UtilityService } from '../UtilityService.js';
|
||||
import { getApId } from './type.js';
|
||||
import { ApPersonService } from './models/ApPersonService.js';
|
||||
import { ApLoggerService } from './ApLoggerService.js';
|
||||
import type { IObject } from './type.js';
|
||||
import { UtilityService } from '../UtilityService.js';
|
||||
|
||||
export type UriParseResult = {
|
||||
/** wether the URI was generated by us */
|
||||
|
@ -225,7 +225,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
|||
* If not found with keyId, update cache and reacquire
|
||||
*/
|
||||
const cacheRaw = this.publicKeyByUserIdCache.cache.get(user.id);
|
||||
if (cacheRaw && cacheRaw.date > Date.now() - 1000 * 60 * 12) {
|
||||
if (cacheRaw && Date.now() - cacheRaw.date > 1000 * 60 * 5) {
|
||||
const exactKey = await this.refreshAndFindKey(user.id, keyId);
|
||||
if (exactKey) return { user, key: exactKey };
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
|||
* lastFetchedAtでの更新制限を弱めて再取得
|
||||
* Reacquisition with weakened update limit at lastFetchedAt
|
||||
*/
|
||||
if (user.lastFetchedAt == null || user.lastFetchedAt < new Date(Date.now() - 1000 * 60 * 12)) {
|
||||
if (user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 5) {
|
||||
this.logger.info(`Fetching user to find public key uri=${uri} userId=${user.id} keyId=${keyId}`);
|
||||
const renewed = await this.apPersonService.fetchPersonWithRenewal(uri, 0);
|
||||
if (renewed == null || renewed.isDeleted) return null;
|
||||
|
|
Loading…
Reference in New Issue