mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 16:22:57 -07:00
Fix plexWatch db importer.
Always return None on exception in http handler. Increase websocket retry counts.
This commit is contained in:
parent
16b20976b6
commit
6e2fa9a3b4
3 changed files with 11 additions and 9 deletions
|
@ -81,10 +81,11 @@ class HTTPHandler(object):
|
||||||
logger.warn(u"Failed to access uri endpoint %s with error %s" % (uri, e))
|
logger.warn(u"Failed to access uri endpoint %s with error %s" % (uri, e))
|
||||||
return None
|
return None
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.warn(u"Failed to access uri endpoint %s. Is your server maybe accepting SSL connections only?" % uri)
|
logger.warn(u"Failed to access uri endpoint %s. Is your server maybe accepting SSL connections only? %s" % (uri, e))
|
||||||
return None
|
return None
|
||||||
except:
|
except:
|
||||||
logger.warn(u"Failed to access uri endpoint %s with Uncaught exception." % uri)
|
logger.warn(u"Failed to access uri endpoint %s with Uncaught exception." % uri)
|
||||||
|
return None
|
||||||
|
|
||||||
if request_status == 200:
|
if request_status == 200:
|
||||||
if output_format == 'dict':
|
if output_format == 'dict':
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from plexpy import logger, helpers, monitor, users, plextv
|
from plexpy import logger, helpers, activity_pinger, activity_processor, users, plextv
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
|
@ -245,9 +245,10 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval
|
||||||
logger.debug(u"PlexPy Importer :: PlexWatch data import in progress...")
|
logger.debug(u"PlexPy Importer :: PlexWatch data import in progress...")
|
||||||
|
|
||||||
logger.debug(u"PlexPy Importer :: Disabling monitoring while import in progress.")
|
logger.debug(u"PlexPy Importer :: Disabling monitoring while import in progress.")
|
||||||
plexpy.schedule_job(monitor.check_active_sessions, 'Check for active sessions', hours=0, minutes=0, seconds=0)
|
plexpy.schedule_job(activity_pinger.check_active_sessions, 'Check for active sessions',
|
||||||
|
hours=0, minutes=0, seconds=0)
|
||||||
|
|
||||||
monitor_processing = monitor.MonitorProcessing()
|
ap = activity_processor.ActivityProcessor()
|
||||||
user_data = users.Users()
|
user_data = users.Users()
|
||||||
|
|
||||||
# Get the latest friends list so we can pull user id's
|
# Get the latest friends list so we can pull user id's
|
||||||
|
@ -373,10 +374,10 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval
|
||||||
# On older versions of PMS, "clip" items were still classified as "movie" and had bad ratingKey values
|
# On older versions of PMS, "clip" items were still classified as "movie" and had bad ratingKey values
|
||||||
# Just make sure that the ratingKey is indeed an integer
|
# Just make sure that the ratingKey is indeed an integer
|
||||||
if session_history_metadata['rating_key'].isdigit():
|
if session_history_metadata['rating_key'].isdigit():
|
||||||
monitor_processing.write_session_history(session=session_history,
|
ap.write_session_history(session=session_history,
|
||||||
import_metadata=session_history_metadata,
|
import_metadata=session_history_metadata,
|
||||||
is_import=True,
|
is_import=True,
|
||||||
import_ignore_interval=import_ignore_interval)
|
import_ignore_interval=import_ignore_interval)
|
||||||
else:
|
else:
|
||||||
logger.debug(u"PlexPy Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key'])
|
logger.debug(u"PlexPy Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key'])
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ def run():
|
||||||
reconnects = 0
|
reconnects = 0
|
||||||
|
|
||||||
# Try an open the websocket connection - if it fails after 5 retries fallback to polling
|
# Try an open the websocket connection - if it fails after 5 retries fallback to polling
|
||||||
while not ws_connected and reconnects < 5:
|
while not ws_connected and reconnects < 15:
|
||||||
try:
|
try:
|
||||||
logger.info(u'PlexPy WebSocket :: Opening websocket, connection attempt %s.' % str(reconnects + 1))
|
logger.info(u'PlexPy WebSocket :: Opening websocket, connection attempt %s.' % str(reconnects + 1))
|
||||||
ws = create_connection(uri)
|
ws = create_connection(uri)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue