mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Fix sync request responding with 500 status code
This commit is contained in:
parent
57d742b862
commit
a1ec10bd0d
@ -343,20 +343,20 @@ class PlaybackSessionManager {
|
||||
* @param {import('../models/User')} user
|
||||
* @param {*} session
|
||||
* @param {*} syncData
|
||||
* @returns
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async syncSession(user, session, syncData) {
|
||||
// TODO: Combine libraryItem query with library query
|
||||
const libraryItem = await Database.libraryItemModel.getExpandedById(session.libraryItemId)
|
||||
if (!libraryItem) {
|
||||
Logger.error(`[PlaybackSessionManager] syncSession Library Item not found "${session.libraryItemId}"`)
|
||||
return null
|
||||
return false
|
||||
}
|
||||
|
||||
const library = await Database.libraryModel.findByPk(libraryItem.libraryId)
|
||||
if (!library) {
|
||||
Logger.error(`[PlaybackSessionManager] syncSession Library not found "${libraryItem.libraryId}"`)
|
||||
return null
|
||||
return false
|
||||
}
|
||||
|
||||
session.currentTime = syncData.currentTime
|
||||
@ -382,6 +382,8 @@ class PlaybackSessionManager {
|
||||
})
|
||||
}
|
||||
this.saveSession(session)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user