mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Fix:Server crash on new libraries when getting filter data #3623
This commit is contained in:
parent
2b0ba7d1e2
commit
778256ca16
@ -510,7 +510,7 @@ module.exports = {
|
|||||||
// If nothing has changed, check if the number of podcasts in
|
// If nothing has changed, check if the number of podcasts in
|
||||||
// library is still the same as prior check before updating cache creation time
|
// library is still the same as prior check before updating cache creation time
|
||||||
|
|
||||||
if (podcastCountFromDatabase === Database.libraryFilterData[libraryId].podcastCount) {
|
if (podcastCountFromDatabase === Database.libraryFilterData[libraryId]?.podcastCount) {
|
||||||
Logger.debug(`Filter data for ${libraryId} has not changed, returning cached data and updating cache time after ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
Logger.debug(`Filter data for ${libraryId} has not changed, returning cached data and updating cache time after ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
||||||
Database.libraryFilterData[libraryId].loadedAt = Date.now()
|
Database.libraryFilterData[libraryId].loadedAt = Date.now()
|
||||||
return cachedFilterData
|
return cachedFilterData
|
||||||
@ -613,7 +613,7 @@ module.exports = {
|
|||||||
if (changedBooks + changedSeries + changedAuthors === 0) {
|
if (changedBooks + changedSeries + changedAuthors === 0) {
|
||||||
// If nothing has changed, check if the number of authors, series, and books
|
// If nothing has changed, check if the number of authors, series, and books
|
||||||
// matches the prior check before updating cache creation time
|
// matches the prior check before updating cache creation time
|
||||||
if (bookCountFromDatabase === Database.libraryFilterData[libraryId].bookCount && seriesCountFromDatabase === Database.libraryFilterData[libraryId].seriesCount && authorCountFromDatabase === Database.libraryFilterData[libraryId].authorCount) {
|
if (bookCountFromDatabase === Database.libraryFilterData[libraryId]?.bookCount && seriesCountFromDatabase === Database.libraryFilterData[libraryId]?.seriesCount && authorCountFromDatabase === Database.libraryFilterData[libraryId].authorCount) {
|
||||||
Logger.debug(`Filter data for ${libraryId} has not changed, returning cached data and updating cache time after ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
Logger.debug(`Filter data for ${libraryId} has not changed, returning cached data and updating cache time after ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
||||||
Database.libraryFilterData[libraryId].loadedAt = Date.now()
|
Database.libraryFilterData[libraryId].loadedAt = Date.now()
|
||||||
return cachedFilterData
|
return cachedFilterData
|
||||||
|
Loading…
Reference in New Issue
Block a user