You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created cache object of HerdCache with positive value of expire_time.
My scenario:
I want to keep behaviour of TTL Redis key (remove after expiration), but still resolve thundering herd problem.
But this part of code doesn't clear for me.
expected_expired_ts = int(time.time())
if expire_time:
expected_expired_ts += expire_time
expected_expired_ts += herd_timeout or self.default_herd_timeout
value = self._pack([value, expected_expired_ts])
return await self.client.set(identity, value, ex=expire_time)
Expected behavior
The value of expected_expired_ts should be less then expire_time, because data will be expired sooner - Redis returns value None and check of expected_expired_ts can't be used.
Actual behavior
Currently it works with infinity TTL for Redis key or negative herd_timeout or self.default_herd_timeout and positive expire_time.
For example herd_timeout is set to -10 (s), default_herd_timeout is set to 10 (s) and expire_time is set to 110 (s)
during 0-89s. nothing happens
in 90s the expected_expired_ts expires, the method get returns None (but data is still store in Redis). Data is extended about 10s. And for this one process is opened window 10s for operation to store new data to the Redis.
The text was updated successfully, but these errors were encountered:
Checklist
Steps to reproduce
I created cache object of HerdCache with positive value of expire_time.
My scenario:
But this part of code doesn't clear for me.
Expected behavior
The value of expected_expired_ts should be less then expire_time, because data will be expired sooner - Redis returns value None and check of expected_expired_ts can't be used.
Actual behavior
For example herd_timeout is set to -10 (s), default_herd_timeout is set to 10 (s) and expire_time is set to 110 (s)
The text was updated successfully, but these errors were encountered: