Merge pull request #3436 from mikiher/create-playback-session-race-condition

Change PlaybackSession createFromOld to use upsert instead of create
This commit is contained in:
advplyr 2024-09-18 15:14:03 -05:00 committed by GitHub
commit 013c7c776e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -182,7 +182,7 @@ class Server {
* @see https://nodejs.org/api/process.html#event-unhandledrejection
*/
process.on('unhandledRejection', async (reason, promise) => {
await Logger.fatal(`[Server] Unhandled rejection: ${reason}, promise:`, util.format('%O', promise))
await Logger.fatal('[Server] Unhandled rejection:', reason, '\npromise:', util.format('%O', promise))
process.exit(1)
})
}

View File

@ -117,7 +117,7 @@ class PlaybackSession extends Model {
static createFromOld(oldPlaybackSession) {
const playbackSession = this.getFromOld(oldPlaybackSession)
return this.create(playbackSession, {
return this.upsert(playbackSession, {
silent: true
})
}