fix(backend): restore date properly of federated instance cache
This commit is contained in:
parent
1377ea4178
commit
ed4a100e96
|
@ -27,7 +27,15 @@ export class FederatedInstanceService {
|
||||||
memoryCacheLifetime: 1000 * 60 * 30, // 30m
|
memoryCacheLifetime: 1000 * 60 * 30, // 30m
|
||||||
fetcher: (key) => this.instancesRepository.findOneBy({ host: key }),
|
fetcher: (key) => this.instancesRepository.findOneBy({ host: key }),
|
||||||
toRedisConverter: (value) => JSON.stringify(value),
|
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,
|
||||||
|
};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue