Skip to content

fix: zero ttl is ignored #2349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 15, 2022
Merged

fix: zero ttl is ignored #2349

merged 3 commits into from
Dec 15, 2022

Conversation

vonovak
Copy link
Contributor

@vonovak vonovak commented Dec 15, 2022

Description

This fixes an issue when a 0 ttl is provided. 0 ttl should mean that the item effectively won't be stored because it's so short-lived. However, the current code fails to pass the 0 ttl to redis, meaning the value is stored forever.

This fixes it. I changed the value in some tests from 1 to 0, as it prevents this bug from reappearing, and I believe the number 0 covers the code just as well as number 1.


btw. it would be nice to have prettier / editorconfig or something like that in place, my ide reformatted the code in a bad way on my first attempt to make changes

Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

@leibale
Copy link
Contributor

leibale commented Dec 15, 2022

@vonovak Thanks for contributing! I'll wait for the tests to pass (although we both know they will...) and then merge it. I'll release the next version tomorrow or at the start of next week.

In the meantime you can use client.sendCommand() to workaround that.

@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2022

Codecov Report

Base: 95.85% // Head: 95.85% // No change to project coverage 👍

Coverage data is based on head (ee1bab0) compared to base (ce1b8f7).
Patch has no changes to coverable lines.

❗ Current head ee1bab0 differs from pull request most recent head 09a41f6. Consider uploading reports for the commit 09a41f6 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2349   +/-   ##
=======================================
  Coverage   95.85%   95.85%           
=======================================
  Files         449      449           
  Lines        4224     4224           
  Branches      471      471           
=======================================
  Hits         4049     4049           
  Misses        107      107           
  Partials       68       68           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@leibale leibale merged commit f6093b7 into redis:master Dec 15, 2022
@vonovak vonovak deleted the fix/zero-ttl branch December 16, 2022 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants