From 752073d590f4a84ba96a794ff53e243be56e586e Mon Sep 17 00:00:00 2001 From: samwiseg0 <2241731+samwiseg0@users.noreply.github.com> Date: Fri, 21 Jan 2022 00:14:15 -0500 Subject: [PATCH] Fixed: Proper warnings for missing data in sonarr and radarr --- varken/radarr.py | 14 +++++++++++--- varken/sonarr.py | 7 +++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/varken/radarr.py b/varken/radarr.py index 5292d4f..9471963 100644 --- a/varken/radarr.py +++ b/varken/radarr.py @@ -66,7 +66,10 @@ class RadarrAPI(object): } ) - self.dbmanager.write_points(influx_payload) + if influx_payload: + self.dbmanager.write_points(influx_payload) + else: + self.logger.warning("No data to send to influx for radarr-missing instance, discarding.") def get_queue(self): endpoint = '/api/v3/queue' @@ -79,6 +82,7 @@ class RadarrAPI(object): req = self.session.prepare_request(Request('GET', self.server.url + endpoint, params=params)) get = connection_handler(self.session, req, self.server.verify_ssl) + if not get: return @@ -101,9 +105,10 @@ class RadarrAPI(object): try: download_queue.append(RadarrQueue(**queueItem)) except TypeError as e: - self.logger.error('TypeError has occurred : %s while creating RadarrQueue structure', e) + self.logger.warning('TypeError has occurred : %s while creating RadarrQueue structure', e) return if not download_queue: + self.logger.warning("No data to send to influx for radarr-queue instance, discarding.") return for queue_item in download_queue: @@ -141,4 +146,7 @@ class RadarrAPI(object): } ) - self.dbmanager.write_points(influx_payload) + if influx_payload: + self.dbmanager.write_points(influx_payload) + else: + self.logger.warning("No data to send to influx for radarr-queue instance, discarding.") diff --git a/varken/sonarr.py b/varken/sonarr.py index ef35328..50c475a 100644 --- a/varken/sonarr.py +++ b/varken/sonarr.py @@ -95,7 +95,10 @@ class SonarrAPI(object): } ) - self.dbmanager.write_points(influx_payload) + if influx_payload: + self.dbmanager.write_points(influx_payload) + else: + self.logger.warning("No data to send to influx for sonarr-calendar instance, discarding.") def get_queue(self): influx_payload = [] @@ -178,4 +181,4 @@ class SonarrAPI(object): if influx_payload: self.dbmanager.write_points(influx_payload) else: - self.logger.debug("No data to send to influx for sonarr instance, discarding.") + self.logger.warning("No data to send to influx for sonarr-queue instance, discarding.")