mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 15:32:38 -07:00
Some more adjustments to the websocket failover retries.
Try to determine if a track was skipped and if so don't log it.
This commit is contained in:
parent
3320f2a2f9
commit
667c6fe3d1
2 changed files with 12 additions and 6 deletions
|
@ -131,6 +131,12 @@ class ActivityProcessor(object):
|
||||||
logger.debug(u"PlexPy ActivityProcessor :: Play duration for ratingKey %s is %s secs which is less than %s "
|
logger.debug(u"PlexPy ActivityProcessor :: Play duration for ratingKey %s is %s secs which is less than %s "
|
||||||
u"seconds, so we're not logging it." %
|
u"seconds, so we're not logging it." %
|
||||||
(session['rating_key'], str(real_play_time), plexpy.CONFIG.LOGGING_IGNORE_INTERVAL))
|
(session['rating_key'], str(real_play_time), plexpy.CONFIG.LOGGING_IGNORE_INTERVAL))
|
||||||
|
if session['media_type'] == 'track' and not is_import:
|
||||||
|
if real_play_time < 15 and session['duration'] >= 30:
|
||||||
|
logging_enabled = False
|
||||||
|
logger.debug(u"PlexPy ActivityProcessor :: Play duration for ratingKey %s is %s secs, "
|
||||||
|
u"looks like it was skipped so we're not logging it" %
|
||||||
|
(session['rating_key'], str(real_play_time)))
|
||||||
elif is_import and import_ignore_interval:
|
elif is_import and import_ignore_interval:
|
||||||
if (session['media_type'] == 'movie' or session['media_type'] == 'episode') and \
|
if (session['media_type'] == 'movie' or session['media_type'] == 'episode') and \
|
||||||
(real_play_time < int(import_ignore_interval)):
|
(real_play_time < int(import_ignore_interval)):
|
||||||
|
|
|
@ -49,8 +49,8 @@ def run():
|
||||||
ws_connected = False
|
ws_connected = False
|
||||||
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 15 retries fallback to polling
|
||||||
while not ws_connected and reconnects < 15:
|
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)
|
||||||
|
@ -69,12 +69,12 @@ def run():
|
||||||
# successfully received data, reset reconnects counter
|
# successfully received data, reset reconnects counter
|
||||||
reconnects = 0
|
reconnects = 0
|
||||||
except websocket.WebSocketConnectionClosedException:
|
except websocket.WebSocketConnectionClosedException:
|
||||||
if reconnects <= 5:
|
if reconnects <= 15:
|
||||||
reconnects += 1
|
reconnects += 1
|
||||||
|
|
||||||
# Increasing sleep interval between reconnections
|
# Sleep 5 between connection attempts
|
||||||
if reconnects > 1:
|
if reconnects > 1:
|
||||||
time.sleep(2 * (reconnects - 1))
|
time.sleep(5)
|
||||||
|
|
||||||
logger.warn(u'PlexPy WebSocket :: Connection has closed, reconnecting...')
|
logger.warn(u'PlexPy WebSocket :: Connection has closed, reconnecting...')
|
||||||
try:
|
try:
|
||||||
|
@ -91,7 +91,7 @@ def run():
|
||||||
plexpy.POLLING_FAILOVER = True
|
plexpy.POLLING_FAILOVER = True
|
||||||
plexpy.initialize_scheduler()
|
plexpy.initialize_scheduler()
|
||||||
|
|
||||||
logger.debug(u'Leaving thread.')
|
logger.debug(u'PlexPy WebSocket :: Leaving thread.')
|
||||||
|
|
||||||
|
|
||||||
def receive(ws):
|
def receive(ws):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue