Skip to content

Commit

Permalink
update: don't check for redis version and catch exception instead
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Jul 8, 2024
1 parent 19d1dec commit 352b325
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ckanext/charts/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,11 @@ 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):
if redis_version >= "7.0.0":
try:
redis_conn.expire(name=key, time=time, lt=True)
else:
except AttributeError:
redis_conn.expire(name=key, time=time)


Expand Down

0 comments on commit 352b325

Please sign in to comment.