diff --git a/lib/cache/sqlite-cache-store.js b/lib/cache/sqlite-cache-store.js index a5afc829413..24ab257d3b2 100644 --- a/lib/cache/sqlite-cache-store.js +++ b/lib/cache/sqlite-cache-store.js @@ -61,7 +61,7 @@ module.exports = class SqliteCacheStore { #countEntriesQuery /** - * @type {import('node:sqlite').StatementSync} + * @type {import('node:sqlite').StatementSync | null} */ #deleteOldValuesQuery @@ -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 } }