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:
@@ -217,14 +217,14 @@ class ActivityHandler(object):
|
||||
# Update the session state and viewOffset
|
||||
self.update_db_session()
|
||||
|
||||
time_since_last_trigger = 0
|
||||
time_since_last_trigger = None
|
||||
if buffer_last_triggered:
|
||||
logger.debug(u"Tautulli ActivityHandler :: Session %s buffer last triggered at %s." %
|
||||
(self.get_session_key(), 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 \
|
||||
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())
|
||||
|
||||
# Retrieve the session data from our temp table
|
||||
|
Reference in New Issue
Block a user