7 ms·
That doesn’t make sense, they can’t assume the lock is freed after the timeout. They have to retry to get the lock again, because another process might have tak
by remote_phone 3y ago
That doesn’t make sense, they can’t assume the lock is freed after the timeout. They have to retry to get the lock again, because another process might have taken the lock. Also, redis is single threaded so access to redis is by definition serialized.
- codegladiator 3y agoThe lock is explicitly release by the redis server itself after the ttl. It's not that the Client will assume that the lock is released.
- xiwenc 3y agoIn the past i used SQS where the client can extend the TTL of a given message (or lock in this case?) while it is still alive. Isn’t that possible with Redis?
- TheCycoONE 3y agoIt is, with quite a bit of flexibility https://redis.io/commands/expire/ https://redis.io/commands/expire/
- cbzoiav 3y agoAs the other guy says the lock is released by the server. If you don't have a mechanism to release it after a timeout, what happens if a node fails?