From 89dc6c19bf0e4a8c715f085ace5a717151d8fe9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Tue, 16 Jan 2024 11:20:35 +0100 Subject: [PATCH] fix(syncing-server): missing item operations metric store expiry --- packages/syncing-server/src/Infra/Redis/RedisMetricStore.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/syncing-server/src/Infra/Redis/RedisMetricStore.ts b/packages/syncing-server/src/Infra/Redis/RedisMetricStore.ts index e35a5ed52..67d8ddefc 100644 --- a/packages/syncing-server/src/Infra/Redis/RedisMetricStore.ts +++ b/packages/syncing-server/src/Infra/Redis/RedisMetricStore.ts @@ -82,16 +82,16 @@ export class RedisMetricStore implements MetricsStoreInterface { const date = this.timer.convertMicrosecondsToDate(metric.props.timestamp) const dateToTheMinuteString = this.timer.convertDateToFormattedString(date, 'YYYY-MM-DD HH:mm') const key = `${this.METRIC_PER_USER_PREFIX}:${userUuid.value}:${metric.props.name}:${dateToTheMinuteString}` + const itemOperationKey = `${this.METRIC_PER_USER_PREFIX}:${userUuid.value}:${Metric.NAMES.ItemOperation}:${dateToTheMinuteString}` const pipeline = this.redisClient.pipeline() pipeline.incrbyfloat(key, value) - pipeline.incr( - `${this.METRIC_PER_USER_PREFIX}:${userUuid.value}:${Metric.NAMES.ItemOperation}:${dateToTheMinuteString}`, - ) + pipeline.incr(itemOperationKey) const expirationTime = 60 * 60 * 24 pipeline.expire(key, expirationTime) + pipeline.expire(itemOperationKey, expirationTime) await pipeline.exec() }