mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Fix race condition for notification stream count when stopping playback
This commit is contained in:
parent
c825176563
commit
a811edb236
1 changed files with 8 additions and 1 deletions
|
@ -536,8 +536,15 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
|
|||
|
||||
ap = activity_processor.ActivityProcessor()
|
||||
sessions = ap.get_sessions()
|
||||
stream_count = len(sessions)
|
||||
user_sessions = ap.get_sessions(user_id=session.get('user_id'))
|
||||
|
||||
# Filter out the session_key from the database sessions for playback stopped events
|
||||
# to prevent race condition between the database and notifications
|
||||
if notify_action == 'on_stop':
|
||||
sessions = [s for s in sessions if str(s['session_key']) != notify_params['session_key']]
|
||||
user_sessions = [s for s in user_sessions if str(s['session_key']) != notify_params['session_key']]
|
||||
|
||||
stream_count = len(sessions)
|
||||
user_stream_count = len(user_sessions)
|
||||
|
||||
# Generate a combined transcode decision value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue