mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 09:44:41 +02:00
Fix:Remove invalid playback sessions on server start #868
This commit is contained in:
parent
3b4ac3a230
commit
8416f2d6be
3 changed files with 31 additions and 3 deletions
|
@ -244,5 +244,16 @@ class PlaybackSessionManager {
|
|||
Logger.error(`[PlaybackSessionManager] cleanOrphanStreams failed`, error)
|
||||
}
|
||||
}
|
||||
|
||||
// Android app v0.9.54 and below had a bug where listening time was sending unix timestamp
|
||||
// See https://github.com/advplyr/audiobookshelf/issues/868
|
||||
// Remove playback sessions with listening time too high
|
||||
async removeInvalidSessions() {
|
||||
const selectFunc = (session) => isNaN(session.timeListening) || Number(session.timeListening) > 3600000000
|
||||
const numSessionsRemoved = await this.db.removeEntities('session', selectFunc)
|
||||
if (numSessionsRemoved) {
|
||||
Logger.info(`[PlaybackSessionManager] Removed ${numSessionsRemoved} invalid playback sessions`)
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = PlaybackSessionManager
|
Loading…
Add table
Add a link
Reference in a new issue