Skip to content
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

fix(refreshThreshold): don't run if ttl is -1 #604

Merged
merged 5 commits into from
Oct 11, 2023

Conversation

mihirgupta0900
Copy link
Contributor

@mihirgupta0900 mihirgupta0900 commented Oct 8, 2023

Please check if the PR fulfills these requirements

  • Followed the Contributing guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix)

In stores like redis, if no ttl value is set, store.ttl(key) returns -1. This causes an issue with the refreshThreshold feature, where the comparison mentioned below will always lead to running the function

https://github.com/node-cache-manager/node-cache-manager/blob/2eca5a0c6c905fe706ed9eaca9152dedd512ef7e/src/caching.ts#L92

I've added an additional check to check for -1 value, and not run the function again.

Note: Wasn't sure where to add test for this, please let me know if I need to. I have tested this manually with my work project

@codecov-commenter
Copy link

Codecov Report

Merging #604 (2434eca) into master (2eca5a0) will not change coverage.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff            @@
##            master      #604   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          292       292           
  Branches        75        75           
=========================================
  Hits           292       292           
Files Coverage Δ
src/caching.ts 100.00% <100.00%> (ø)

@jaredwray jaredwray merged commit 66246e9 into jaredwray:master Oct 11, 2023
3 checks passed
@jaredwray
Copy link
Owner

@mihirgupta0900 - thanks for this fix. This should be released with our next update which will be in 2-3 weeks. 🍻

renovate bot referenced this pull request in tf2pickup-org/server Nov 17, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[cache-manager](https://togithub.com/node-cache-manager/node-cache-manager)
| [`5.2.4` ->
`5.3.1`](https://renovatebot.com/diffs/npm/cache-manager/5.2.4/5.3.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/cache-manager/5.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/cache-manager/5.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/cache-manager/5.2.4/5.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/cache-manager/5.2.4/5.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>node-cache-manager/node-cache-manager (cache-manager)</summary>

###
[`v5.3.1`](https://togithub.com/node-cache-manager/node-cache-manager/releases/tag/v5.3.1)

[Compare
Source](https://togithub.com/node-cache-manager/node-cache-manager/compare/v5.3.0...v5.3.1)

Major fix as `5.3.0` did not have the dist folder on release.

#### What's Changed

- updating to always run vitest with coverage by
[@&#8203;jaredwray](https://togithub.com/jaredwray) in
[https://github.com/node-cache-manager/node-cache-manager/pull/605](https://togithub.com/node-cache-manager/node-cache-manager/pull/605)
- fix(refreshThreshold): don't run if ttl is -1 by
[@&#8203;mihirgupta0900](https://togithub.com/mihirgupta0900) in
[https://github.com/node-cache-manager/node-cache-manager/pull/604](https://togithub.com/node-cache-manager/node-cache-manager/pull/604)
- fix(caching): coalesce concurrent requests to `wrap` function by
[@&#8203;douglascayers](https://togithub.com/douglascayers) in
[https://github.com/node-cache-manager/node-cache-manager/pull/599](https://togithub.com/node-cache-manager/node-cache-manager/pull/599)
- upgrading lru-cache to 10.0.2 by
[@&#8203;jaredwray](https://togithub.com/jaredwray) in
[https://github.com/node-cache-manager/node-cache-manager/pull/609](https://togithub.com/node-cache-manager/node-cache-manager/pull/609)
- upgrading eslint, prettier, and types to latest by
[@&#8203;jaredwray](https://togithub.com/jaredwray) in
[https://github.com/node-cache-manager/node-cache-manager/pull/610](https://togithub.com/node-cache-manager/node-cache-manager/pull/610)

#### New Contributors

- [@&#8203;mihirgupta0900](https://togithub.com/mihirgupta0900) made
their first contribution in
[https://github.com/node-cache-manager/node-cache-manager/pull/604](https://togithub.com/node-cache-manager/node-cache-manager/pull/604)
- [@&#8203;douglascayers](https://togithub.com/douglascayers) made their
first contribution in
[https://github.com/node-cache-manager/node-cache-manager/pull/599](https://togithub.com/node-cache-manager/node-cache-manager/pull/599)

**Full Changelog**:
jaredwray/cacheable@5.2.4...v5.3.1

###
[`v5.3.0`](https://togithub.com/node-cache-manager/node-cache-manager/releases/tag/v5.3.0)

[Compare
Source](https://togithub.com/node-cache-manager/node-cache-manager/compare/5.2.4...v5.3.0)

#### What's Changed

- updating to always run vitest with coverage by
[@&#8203;jaredwray](https://togithub.com/jaredwray) in
[https://github.com/node-cache-manager/node-cache-manager/pull/605](https://togithub.com/node-cache-manager/node-cache-manager/pull/605)
- fix(refreshThreshold): don't run if ttl is -1 by
[@&#8203;mihirgupta0900](https://togithub.com/mihirgupta0900) in
[https://github.com/node-cache-manager/node-cache-manager/pull/604](https://togithub.com/node-cache-manager/node-cache-manager/pull/604)
- fix(caching): coalesce concurrent requests to `wrap` function by
[@&#8203;douglascayers](https://togithub.com/douglascayers) in
[https://github.com/node-cache-manager/node-cache-manager/pull/599](https://togithub.com/node-cache-manager/node-cache-manager/pull/599)
- upgrading lru-cache to 10.0.2 by
[@&#8203;jaredwray](https://togithub.com/jaredwray) in
[https://github.com/node-cache-manager/node-cache-manager/pull/609](https://togithub.com/node-cache-manager/node-cache-manager/pull/609)
- upgrading eslint, prettier, and types to latest by
[@&#8203;jaredwray](https://togithub.com/jaredwray) in
[https://github.com/node-cache-manager/node-cache-manager/pull/610](https://togithub.com/node-cache-manager/node-cache-manager/pull/610)

#### New Contributors

- [@&#8203;mihirgupta0900](https://togithub.com/mihirgupta0900) made
their first contribution in
[https://github.com/node-cache-manager/node-cache-manager/pull/604](https://togithub.com/node-cache-manager/node-cache-manager/pull/604)
- [@&#8203;douglascayers](https://togithub.com/douglascayers) made their
first contribution in
[https://github.com/node-cache-manager/node-cache-manager/pull/599](https://togithub.com/node-cache-manager/node-cache-manager/pull/599)

**Full Changelog**:
jaredwray/cacheable@5.2.4...v5.3.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tf2pickup-org/server).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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