Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading