Skip to content

Commit

Permalink
fix: sqlite null ref (#4016)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag authored Jan 20, 2025
1 parent 83537aa commit d76f5cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/cache/sqlite-cache-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = class SqliteCacheStore {
#countEntriesQuery

/**
* @type {import('node:sqlite').StatementSync}
* @type {import('node:sqlite').StatementSync | null}
*/
#deleteOldValuesQuery

Expand Down Expand Up @@ -344,14 +344,14 @@ module.exports = class SqliteCacheStore {

{
const removed = this.#deleteExpiredValuesQuery.run(Date.now()).changes
if (removed > 0) {
if (removed) {
return removed
}
}

{
const removed = this.#deleteOldValuesQuery.run(Math.max(Math.floor(this.#maxCount * 0.1), 1)).changes
if (removed > 0) {
const removed = this.#deleteOldValuesQuery?.run(Math.max(Math.floor(this.#maxCount * 0.1), 1)).changes
if (removed) {
return removed
}
}
Expand Down

0 comments on commit d76f5cf

Please sign in to comment.