Avoid setting an invalid TTL in duplicate job middleware
What does this MR do and why?
The LUA script in the Sidekiq duplicate job middleware attempts to update the WAL locations in a msgpack-serialized cookie. When it writes back the key, it also tries to maintain the existing TTL. However, if the TTL becomes 0, then Redis will raise an error: "@user_script:7: ERR invalid expire time in set".
As far as I can tell, this hasn't happened in production yet, but it
could if an idempotent Sidekiq job runs update_latest_wal_location!
just when the TTL expires.
Instead of setting the TTL, we can use the Redis 6.0 KEEPTTL option (https://redis.io/commands/set/).
Relates to #416769 (closed)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.