Skip to content

Commit

Permalink
Fix sync request responding with 500 status code
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Jan 6, 2025
1 parent 57d742b commit a1ec10b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/managers/PlaybackSessionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -382,6 +382,8 @@ class PlaybackSessionManager {
})
}
this.saveSession(session)

return true
}

/**
Expand Down

0 comments on commit a1ec10b

Please sign in to comment.