Multithreaded notification queue

This commit is contained in:
JonnyWong16 2016-10-03 20:56:30 -07:00 committed by JonnyWong16
parent 82f4c99025
commit 08a8b5fee0
5 changed files with 38 additions and 58 deletions

View file

@ -99,8 +99,7 @@ class ActivityProcessor(object):
# Check if any notification agents have notifications enabled
if notify:
values.update({'ip_address': session['ip_address']})
plexpy.NOTIFY_QUEUE.put(notification_handler.add_to_queue(
stream_data=values, notify_action='on_play'))
plexpy.NOTIFY_QUEUE.put({'stream_data': values, 'notify_action': 'on_play'})
# If it's our first write then time stamp it.
started = int(time.time())
@ -116,10 +115,8 @@ class ActivityProcessor(object):
self.db.upsert('sessions', ip_address, keys)
if notify:
plexpy.NOTIFY_QUEUE.put(notification_handler.add_to_queue(
stream_data=values, notify_action='on_concurrent'))
plexpy.NOTIFY_QUEUE.put(notification_handler.add_to_queue(
stream_data=values, notify_action='on_newdevice'))
plexpy.NOTIFY_QUEUE.put({'stream_data': values, 'notify_action': 'on_concurrent'})
plexpy.NOTIFY_QUEUE.put({'stream_data': values, 'notify_action': 'on_newdevice'})
return True