Fix sync request responding with 500 status code

This commit is contained in:
advplyr 2025-01-06 11:39:55 -06:00
parent 57d742b862
commit a1ec10bd0d

View File

@ -343,20 +343,20 @@ class PlaybackSessionManager {
* @param {import('../models/User')} user * @param {import('../models/User')} user
* @param {*} session * @param {*} session
* @param {*} syncData * @param {*} syncData
* @returns * @returns {Promise<boolean>}
*/ */
async syncSession(user, session, syncData) { async syncSession(user, session, syncData) {
// TODO: Combine libraryItem query with library query // TODO: Combine libraryItem query with library query
const libraryItem = await Database.libraryItemModel.getExpandedById(session.libraryItemId) const libraryItem = await Database.libraryItemModel.getExpandedById(session.libraryItemId)
if (!libraryItem) { if (!libraryItem) {
Logger.error(`[PlaybackSessionManager] syncSession Library Item not found "${session.libraryItemId}"`) Logger.error(`[PlaybackSessionManager] syncSession Library Item not found "${session.libraryItemId}"`)
return null return false
} }
const library = await Database.libraryModel.findByPk(libraryItem.libraryId) const library = await Database.libraryModel.findByPk(libraryItem.libraryId)
if (!library) { if (!library) {
Logger.error(`[PlaybackSessionManager] syncSession Library not found "${libraryItem.libraryId}"`) Logger.error(`[PlaybackSessionManager] syncSession Library not found "${libraryItem.libraryId}"`)
return null return false
} }
session.currentTime = syncData.currentTime session.currentTime = syncData.currentTime
@ -382,6 +382,8 @@ class PlaybackSessionManager {
}) })
} }
this.saveSession(session) this.saveSession(session)
return true
} }
/** /**