mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Only schedule job for recently added or monitor remote access if setting enabled
This commit is contained in:
parent
112811f3e2
commit
89f581f63e
5 changed files with 45 additions and 21 deletions
|
@ -33,7 +33,11 @@ def check_active_sessions(ws_request=False):
|
|||
monitor_process = activity_processor.ActivityProcessor()
|
||||
# logger.debug(u"PlexPy Monitor :: Checking for active streams.")
|
||||
|
||||
global int_ping_count
|
||||
|
||||
if session_list:
|
||||
int_ping_count = 0
|
||||
|
||||
media_container = session_list['sessions']
|
||||
|
||||
# Check our temp table for what we must do with the new streams
|
||||
|
@ -165,6 +169,16 @@ def check_active_sessions(ws_request=False):
|
|||
else:
|
||||
logger.debug(u"PlexPy Monitor :: Unable to read session list.")
|
||||
|
||||
int_ping_count += 1
|
||||
logger.warn(u"PlexPy Monitor :: Unable to get an internal response from the server, ping attempt %s." \
|
||||
% str(int_ping_count))
|
||||
|
||||
if int_ping_count == 3:
|
||||
# Fire off notifications
|
||||
threading.Thread(target=notification_handler.notify_timeline,
|
||||
kwargs=dict(notify_action='intdown')).start()
|
||||
|
||||
|
||||
def check_recently_added():
|
||||
|
||||
with monitor_lock:
|
||||
|
@ -231,20 +245,10 @@ def check_server_response():
|
|||
pms_connect = pmsconnect.PmsConnect()
|
||||
server_response = pms_connect.get_server_response()
|
||||
|
||||
global int_ping_count
|
||||
global ext_ping_count
|
||||
|
||||
# Check for internal server response
|
||||
if not server_response:
|
||||
int_ping_count += 1
|
||||
logger.warn(u"PlexPy Monitor :: Unable to get an internal response from the server, ping attempt %s." \
|
||||
% str(int_ping_count))
|
||||
# Reset internal ping counter
|
||||
else:
|
||||
int_ping_count = 0
|
||||
|
||||
# Check for remote access
|
||||
if server_response and plexpy.CONFIG.MONITOR_REMOTE_ACCESS:
|
||||
if server_response:
|
||||
|
||||
mapping_state = server_response['mapping_state']
|
||||
mapping_error = server_response['mapping_error']
|
||||
|
@ -263,11 +267,6 @@ def check_server_response():
|
|||
else:
|
||||
ext_ping_count = 0
|
||||
|
||||
if int_ping_count == 3:
|
||||
# Fire off notifications
|
||||
threading.Thread(target=notification_handler.notify_timeline,
|
||||
kwargs=dict(notify_action='intdown')).start()
|
||||
|
||||
if ext_ping_count == 3:
|
||||
# Fire off notifications
|
||||
threading.Thread(target=notification_handler.notify_timeline,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue