From b9367c4c25dd7bbc8146bd1b738960c2a56e9e17 Mon Sep 17 00:00:00 2001 From: 9Mad-Max5 Date: Sun, 25 Aug 2024 22:20:54 +0200 Subject: [PATCH] fix the for loop for direct connection check --- feedcrawler/external_tools/myjd_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feedcrawler/external_tools/myjd_api.py b/feedcrawler/external_tools/myjd_api.py index 03df6006..70145572 100644 --- a/feedcrawler/external_tools/myjd_api.py +++ b/feedcrawler/external_tools/myjd_api.py @@ -839,7 +839,7 @@ def action(self, path, params=(), http_action="POST"): return response['data'] else: # Direct connection info available, we try to use it. - for conn in self.__direct_connection_info: + for conn in self.__direct_connection_info[:]: connection_ip = conn['conn']['ip'] # prevent connection to internal docker ip if time.time() > conn['cooldown']: @@ -863,6 +863,7 @@ def action(self, path, params=(), http_action="POST"): conn['cooldown'] = time.time() + 3600 self.__direct_connection_info.remove(conn) self.__direct_connection_info.append(conn) + # None of the direct connections worked, we set a cooldown for direct connections self.__direct_connection_consecutive_failures += 1 self.__direct_connection_cooldown = time.time() + (60 * self.__direct_connection_consecutive_failures)