fix merge errors

This commit is contained in:
Hazelnoot 2025-10-06 11:41:44 -04:00
parent a0b2ef780b
commit e1044879ea
3 changed files with 17 additions and 16 deletions

View file

@ -20,6 +20,7 @@ import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
import { bindThis } from '@/decorators.js';
import { renderInlineError } from '@/misc/render-inline-error.js';
import { CacheService } from '@/core/CacheService.js';
import { TimeService } from '@/core/TimeService.js';
import * as Acct from '@/misc/acct.js';
import { IdentifiableError } from '@/misc/identifiable-error.js';
import { InternalEventService } from '@/core/InternalEventService.js';
@ -43,6 +44,7 @@ export class RemoteUserResolveService {
private apPersonService: ApPersonService,
private readonly cacheService: CacheService,
private readonly internalEventService: InternalEventService,
private readonly timeService: TimeService,
) {
this.logger = this.remoteLoggerService.logger.createSubLogger('resolve-user');
this.selfHost = this.utilityService.toPuny(this.config.host);
@ -99,7 +101,7 @@ export class RemoteUserResolveService {
private async tryUpdateUser(user: MiRemoteUser, acctLower: string): Promise<MiRemoteUser> {
// Don't update unless the user is at least 24 hours outdated.
// ユーザー情報が古い場合は、WebFingerからやりなおして返す
if (user.lastFetchedAt != null && Date.now() - user.lastFetchedAt.getTime() <= 1000 * 60 * 60 * 24) {
if (user.lastFetchedAt != null && this.timeService.now - user.lastFetchedAt.getTime() <= 1000 * 60 * 60 * 24) {
return user;
}
@ -116,7 +118,7 @@ export class RemoteUserResolveService {
// Always mark as updated so we don't get stuck here for missing remote users.
// 繋がらないインスタンスに何回も試行するのを防ぐ, 後続の同様処理の連続試行を防ぐ ため 試行前にも更新する
await this.usersRepository.update(user.id, {
lastFetchedAt: new Date(),
lastFetchedAt: this.timeService.now,
});
}

View file

@ -8,7 +8,19 @@ import Redis from 'ioredis';
import type { MiUser } from '@/models/_.js';
import { TimeService } from '@/global/TimeService.js';
import { EnvService } from '@/global/EnvService.js';
import { BucketRateLimit, LegacyRateLimit, LimitInfo, RateLimit, hasMinLimit, isLegacyRateLimit, Keyed, hasMaxLimit, disabledLimitInfo, MaxLegacyLimit, MinLegacyLimit } from '@/misc/rate-limit-utils.js';
import {
type BucketRateLimit,
type LegacyRateLimit,
type LimitInfo,
type RateLimit,
type Keyed,
type MaxLegacyLimit,
type MinLegacyLimit,
hasMinLimit,
isLegacyRateLimit,
hasMaxLimit,
disabledLimitInfo,
} from '@/misc/rate-limit-utils.js';
import { RoleService } from '@/core/RoleService.js';
import { CacheManagementService, type ManagedMemoryKVCache } from '@/global/CacheManagementService.js';
import { ConflictError } from '@/misc/errors/ConflictError.js';

View file

@ -58,19 +58,6 @@ describe(SkRateLimiterService, () => {
};
});
afterEach(() => {
cacheManagementService.dispose();
mockInternalEventService.mockReset();
mockRedis.mockReset();
mockEnvService.mockReset();
mockEnvService.env.NODE_ENV = 'production';
});
afterEach(() => {
serviceUnderTest().dispose();
});
describe('limit', () => {
const actor = 'actor';
const key = 'test';