mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Don't double notify on fast buffer triggers
If two buffer notifications come in at the same second right at the cusp of the notification trigger the difference between the current and last trigger would be 0, causing it to send two notifications. Change the initial value to `None` to prevent this from happening.
This commit is contained in:
parent
fb2362be24
commit
67f70fab90
1 changed files with 7 additions and 7 deletions
|
@ -217,14 +217,14 @@ class ActivityHandler(object):
|
||||||
# Update the session state and viewOffset
|
# Update the session state and viewOffset
|
||||||
self.update_db_session()
|
self.update_db_session()
|
||||||
|
|
||||||
time_since_last_trigger = 0
|
time_since_last_trigger = None
|
||||||
if buffer_last_triggered:
|
if buffer_last_triggered:
|
||||||
logger.debug(u"Tautulli ActivityHandler :: Session %s buffer last triggered at %s." %
|
logger.debug(u"Tautulli ActivityHandler :: Session %s buffer last triggered at %s." %
|
||||||
(self.get_session_key(), buffer_last_triggered))
|
(self.get_session_key(), buffer_last_triggered))
|
||||||
time_since_last_trigger = int(time.time()) - int(buffer_last_triggered)
|
time_since_last_trigger = int(time.time()) - int(buffer_last_triggered)
|
||||||
|
|
||||||
if plexpy.CONFIG.BUFFER_THRESHOLD > 0 and (current_buffer_count >= plexpy.CONFIG.BUFFER_THRESHOLD and \
|
if plexpy.CONFIG.BUFFER_THRESHOLD > 0 and (current_buffer_count >= plexpy.CONFIG.BUFFER_THRESHOLD and \
|
||||||
time_since_last_trigger == 0 or time_since_last_trigger >= plexpy.CONFIG.BUFFER_WAIT):
|
time_since_last_trigger is None or time_since_last_trigger >= plexpy.CONFIG.BUFFER_WAIT):
|
||||||
ap.set_session_buffer_trigger_time(session_key=self.get_session_key())
|
ap.set_session_buffer_trigger_time(session_key=self.get_session_key())
|
||||||
|
|
||||||
# Retrieve the session data from our temp table
|
# Retrieve the session data from our temp table
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue