[PR #3980] [MERGED] Fix count cache by stringify Symbols #3979 #4138

Closed
opened 2026-04-25 00:18:28 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3980
Author: @advplyr
Created: 2/14/2025
Status: Merged
Merged: 2/14/2025
Merged by: @advplyr

Base: masterHead: stringify_sequelize_query


📝 Commits (1)

📊 Changes

2 files changed (+37 additions, -2 deletions)

View changed files

📝 server/utils/queries/libraryItemsBookFilters.js (+3 -2)
server/utils/stringifySequelizeQuery.js (+34 -0)

📄 Description

Brief summary

Book library queries are returning the incorrect count because the cached key is matching when it shouldn't.

Sequelizes uses Symbols in the queries and JSON.stringify ignores these. This adds a separate function that sanitizes the query before Stringify.

Which issue is fixed?

Fixes #3979

In-depth Description

Reproduce by filtering by Issues and clearing the filter. Those 2 cache keys will be the same because the library item where option is not stringified.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3980 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 2/14/2025 **Status:** ✅ Merged **Merged:** 2/14/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `stringify_sequelize_query` --- ### 📝 Commits (1) - [`5ca12ee`](https://github.com/advplyr/audiobookshelf/commit/5ca12eee19a8d64d0a2f029465e228da15ca799c) Fix count cache by stringify Symbols #3979 ### 📊 Changes **2 files changed** (+37 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/queries/libraryItemsBookFilters.js` (+3 -2) ➕ `server/utils/stringifySequelizeQuery.js` (+34 -0) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Book library queries are returning the incorrect count because the cached key is matching when it shouldn't. Sequelizes uses Symbols in the queries and JSON.stringify ignores these. This adds a separate function that sanitizes the query before Stringify. ## Which issue is fixed? Fixes #3979 ## In-depth Description Reproduce by filtering by Issues and clearing the filter. Those 2 cache keys will be the same because the library item where option is not stringified. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:28 +02:00
adam closed this issue 2026-04-25 00:18:28 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4138