Skip to content

Commit

Permalink
check redis version before using lt arg
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Jun 6, 2024
1 parent 27677cd commit 44c48b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckanext/charts/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ def update_redis_expiration(time: int) -> None:
return

redis_conn = RedisCache().client
redis_version = redis_conn.info().get('redis_version', '0.0.0')

for key in redis_conn.scan_iter(const.REDIS_PREFIX):
redis_conn.expire(name=key, time=time, lt=True)
if redis_version >= "7.0.0":
redis_conn.expire(name=key, time=time, lt=True)
else:
redis_conn.expire(name=key, time=time)


def count_redis_cache_size() -> int:
Expand Down

0 comments on commit 44c48b0

Please sign in to comment.