From 1fdad498f6cdbfd238ce75e21a4e06801b6355e9 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 17 May 2021 23:57:42 -0400 Subject: [PATCH] Fixed the movies not getting synced after a reconnection of Radarr SignalR feed. --- bazarr/signalr_client.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bazarr/signalr_client.py b/bazarr/signalr_client.py index c9e65980a..1918c461f 100644 --- a/bazarr/signalr_client.py +++ b/bazarr/signalr_client.py @@ -83,8 +83,6 @@ class RadarrSignalrClient: self.configure() logging.debug('BAZARR connecting to Radarr SignalR feed...') self.connection.start() - if not args.dev: - scheduler.execute_job_now('update_movies') def stop(self): logging.info('BAZARR SignalR client for Radarr is now disconnected.') @@ -100,6 +98,12 @@ class RadarrSignalrClient: logging.error("BAZARR connection to Radarr SignalR feed has failed. We'll try to reconnect.") self.restart() + @staticmethod + def on_connect_handler(): + logging.info('BAZARR SignalR client for Radarr is connected and waiting for events.') + if not args.dev: + scheduler.execute_job_now('update_movies') + def configure(self): self.apikey_radarr = settings.radarr.apikey self.connection = HubConnectionBuilder() \ @@ -113,8 +117,7 @@ class RadarrSignalrClient: "reconnect_interval": 5, "max_attempts": None }).build() - self.connection.on_open(lambda: logging.info('BAZARR SignalR client for Radarr is connected and waiting for ' - 'events.')) + self.connection.on_open(self.on_connect_handler) self.connection.on_reconnect(lambda: logging.info('BAZARR SignalR client for Radarr connection as been lost. ' 'Trying to reconnect...')) self.connection.on_close(lambda: logging.debug('BAZARR SignalR client for Radarr is disconnected.'))