mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-07 01:15:44 +02:00
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:
commit
013c7c776e
@ -182,7 +182,7 @@ class Server {
|
|||||||
* @see https://nodejs.org/api/process.html#event-unhandledrejection
|
* @see https://nodejs.org/api/process.html#event-unhandledrejection
|
||||||
*/
|
*/
|
||||||
process.on('unhandledRejection', async (reason, promise) => {
|
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)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class PlaybackSession extends Model {
|
|||||||
|
|
||||||
static createFromOld(oldPlaybackSession) {
|
static createFromOld(oldPlaybackSession) {
|
||||||
const playbackSession = this.getFromOld(oldPlaybackSession)
|
const playbackSession = this.getFromOld(oldPlaybackSession)
|
||||||
return this.create(playbackSession, {
|
return this.upsert(playbackSession, {
|
||||||
silent: true
|
silent: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user