From 4fc762958c668257f44df8c13fee9bd0846685ee Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Thu, 6 Nov 2025 22:17:52 -0500 Subject: [PATCH] use TimeService in CacheService --- packages/backend/src/core/CacheService.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/CacheService.ts b/packages/backend/src/core/CacheService.ts index 8b66a26204..adb9b17061 100644 --- a/packages/backend/src/core/CacheService.ts +++ b/packages/backend/src/core/CacheService.ts @@ -15,6 +15,7 @@ import { bindThis } from '@/decorators.js'; import type { InternalEventTypes } from '@/core/GlobalEventService.js'; import { InternalEventService } from '@/global/InternalEventService.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { TimeService } from '@/global/TimeService.js'; import { CacheManagementService, type ManagedMemoryKVCache, @@ -104,6 +105,7 @@ export class CacheService implements OnApplicationShutdown { private readonly internalEventService: InternalEventService, private readonly cacheManagementService: CacheManagementService, + private readonly timeService: TimeService, ) { //this.onMessage = this.onMessage.bind(this); @@ -128,7 +130,7 @@ export class CacheService implements OnApplicationShutdown { .where({ muterId: In(muterIds) }) .andWhere(new Brackets(qb => qb .orWhere({ expiresAt: IsNull() }) - .orWhere({ expiresAt: MoreThan(new Date()) }))) + .orWhere({ expiresAt: MoreThan(this.timeService.date) }))) .groupBy('muting.muterId') .getRawMany<{ muterId: string, muteeIds: string[] }>() .then(ms => ms.map(m => [m.muterId, new Set(m.muteeIds)])), @@ -144,7 +146,7 @@ export class CacheService implements OnApplicationShutdown { .where({ muteeId: In(muteeIds) }) .andWhere(new Brackets(qb => qb .orWhere({ expiresAt: IsNull() }) - .orWhere({ expiresAt: MoreThan(new Date()) }))) + .orWhere({ expiresAt: MoreThan(this.timeService.date) }))) .groupBy('muting.muteeId') .getRawMany<{ muteeId: string, muterIds: string[] }>() .then(ms => ms.map(m => [m.muteeId, new Set(m.muterIds)])),