fix(redis): Don't SETEX with a non-positive TTL - #456
Conversation
|
Hmm, I might be missing something but shouldn't we be catching this at a higher layer? I believe the catching RFCs say that invalid ages/TTLs should be treated as |
|
Ooo, I was not familiar with this part of the spec... Indeed, the much cleaner fix is to reject negative values much earlier.
I can refine the PR to just handle the |
|
Yeah, that sounds good to me. Specifically we should normalize k valid TTLs to zero (and emit a warning log in that case, maybe?), which the controller logic should then treat as "don't cache this." (That'll change the Google behavior but IMO that's good -- we should follow the specs precisely here.) |
78e62a8 to
55d730c
Compare
RedisCache.set forwarded its expiry straight to SETEX, which Redis rejects for seconds
<=0with an "invalid expire time" ResponseError.(Verified against a local redis container)