From 9d4cc84c4eef7ca1903f78b44180d0bc80144eb9 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Mon, 14 Apr 2025 22:02:12 +0200 Subject: [PATCH] test: fix maxSnapshotCacheTtl when is infinite --- .../event/projection/ProjectionSnapshotRepositoryInRedis.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/eventDemo/libs/event/projection/ProjectionSnapshotRepositoryInRedis.kt b/src/main/kotlin/eventDemo/libs/event/projection/ProjectionSnapshotRepositoryInRedis.kt index 572f31f..5141c35 100644 --- a/src/main/kotlin/eventDemo/libs/event/projection/ProjectionSnapshotRepositoryInRedis.kt +++ b/src/main/kotlin/eventDemo/libs/event/projection/ProjectionSnapshotRepositoryInRedis.kt @@ -136,7 +136,9 @@ class ProjectionSnapshotRepositoryInRedis, P : Projection, ID logger.error { "Projection NOT saved (already exists)" } } else { logger.info { "Projection saved" } - jedis.expire(projection.redisKey, snapshotCacheConfig.maxSnapshotCacheTtl.inWholeSeconds) + if (snapshotCacheConfig.maxSnapshotCacheTtl.isFinite()) { + jedis.expire(projection.redisKey, snapshotCacheConfig.maxSnapshotCacheTtl.inWholeSeconds) + } } }