Skip to content
  • Stan Hu's avatar
    Avoid setting an invalid TTL in duplicate job middleware · 72ba5165
    Stan Hu authored
    The LUA script in the Sidekiq duplicate job middleware attempts to
    update the deduplicated flag 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".
    
    When we lowered the deduplication TTL of
    `::Namespaces::ProcessSyncEventsWorker`from 6 hours to 1 minute in
    !120580, this
    exposed a bug in the LUA script because the tests repeatedly call this
    middleware. To fix this, we don't bother writing back the key if the
    TTL is not > 0.
    
    Relates to #411325
    72ba5165