Open zidokobik opened 1 month ago
Previously closed thinking it was due to passive expiration, but the bug still persists.
Hi! Can you please try replacing
cardinality = await redis.scard(KEY)
with
members = await redis.smembers()
assert members == []
Our set expiration logic is lazy, i.e. it invalidates only when a specific member is accessed.
Yes, that's why the issue was closed before. I edited the snipped to add
# actively expire by reading the key
await redis.smembers(KEY)
but the problem still persists, hence I reopened the issue. Inspecting with redis-cli
confirms there are still some values left.
Describe the bug
SADDEX
fails to expire members occasionally. Leaving them not having an expiration.To Reproduce Here's a test run in python with the redis-py package:
Expected behavior The test runs without error, i.e. the set should be empty.
Environment (please complete the following information):
Additional context I have a service in which I need to keep track of client's requests concurrency. I use a set to store the request starting-time as members, then it's
SREM
when the response is returned, therefore keeping the cardinality as the number of on-flight requests. I useSADDEX
(add members with expiration to a set) instead of the normalSADD
so that if any error occurs, the member will get removed automatically after a certain timeout. I'm aware thatSADDEX
is dragonfly-only and experimental, it's the one of the reason I'm using dragonfly over redis.