From ed4a100e969dab5b7d561dddc99e719f4ca5a676 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 7 Apr 2023 18:55:11 +0900 Subject: [PATCH] fix(backend): restore date properly of federated instance cache --- packages/backend/src/core/FederatedInstanceService.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/FederatedInstanceService.ts b/packages/backend/src/core/FederatedInstanceService.ts index bc66591bc9..1d0c87280f 100644 --- a/packages/backend/src/core/FederatedInstanceService.ts +++ b/packages/backend/src/core/FederatedInstanceService.ts @@ -27,7 +27,15 @@ export class FederatedInstanceService { memoryCacheLifetime: 1000 * 60 * 30, // 30m fetcher: (key) => this.instancesRepository.findOneBy({ host: key }), toRedisConverter: (value) => JSON.stringify(value), - fromRedisConverter: (value) => JSON.parse(value), // TODO: date型の考慮 + fromRedisConverter: (value) => { + const parsed = JSON.parse(value); + return { + ...parsed, + firstRetrievedAt: new Date(parsed.firstRetrievedAt), + latestRequestReceivedAt: parsed.latestRequestReceivedAt ? new Date(parsed.latestRequestReceivedAt) : null, + infoUpdatedAt: parsed.infoUpdatedAt ? new Date(parsed.infoUpdatedAt) : null, + }; + }, }); }