mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 01:02:59 -07:00
Only update the database sessions every 60 seconds while playing
This commit is contained in:
parent
9b4536f132
commit
157af84226
5 changed files with 21 additions and 8 deletions
|
@ -33,6 +33,7 @@ ACTIVITY_SCHED = BackgroundScheduler()
|
|||
|
||||
RECENTLY_ADDED_QUEUE = {}
|
||||
|
||||
|
||||
class ActivityHandler(object):
|
||||
|
||||
def __init__(self, timeline):
|
||||
|
@ -229,9 +230,11 @@ class ActivityHandler(object):
|
|||
# Update the session state and viewOffset
|
||||
if this_state == 'playing':
|
||||
# Update the session in our temp session table
|
||||
session = self.get_live_session()
|
||||
if session:
|
||||
self.update_db_session(session=session)
|
||||
# if the last set temporary stopped time exceeds 15 seconds
|
||||
if int(time.time()) - db_session['stopped'] > 60:
|
||||
session = self.get_live_session()
|
||||
if session:
|
||||
self.update_db_session(session=session)
|
||||
|
||||
# Start our state checks
|
||||
if this_state != last_state:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue