From a61b45ab90e441c0877f44be11fff2468ae96b9c Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Mon, 28 Aug 2023 22:10:36 -0400 Subject: [PATCH] monitor will try to reconnect manually. If the client never connects originally it won't try to reconnect --- pioreactor/actions/self_test.py | 2 +- pioreactor/background_jobs/monitor.py | 9 +++++++++ requirements/requirements.txt | 2 +- setup.py | 2 +- update_scripts/32.7.31/update.sh | 9 --------- 5 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 update_scripts/32.7.31/update.sh diff --git a/pioreactor/actions/self_test.py b/pioreactor/actions/self_test.py index 108d0b67..fc56b476 100644 --- a/pioreactor/actions/self_test.py +++ b/pioreactor/actions/self_test.py @@ -211,7 +211,7 @@ def test_all_positive_correlations_between_pds_and_leds( for ir_pd_channel in pd_channels_to_test: assert ( - results[(ir_led_channel, ir_pd_channel)] > 0.925 + results[(ir_led_channel, ir_pd_channel)] > 0.9 ), f"missing {ir_led_channel} ⇝ {ir_pd_channel}" diff --git a/pioreactor/background_jobs/monitor.py b/pioreactor/background_jobs/monitor.py index ae496adf..d1ca4c7a 100644 --- a/pioreactor/background_jobs/monitor.py +++ b/pioreactor/background_jobs/monitor.py @@ -345,6 +345,15 @@ def check_for_mqtt_connection_to_leader(self) -> None: self.set_state(self.LOST) self.flicker_led_with_error_code(error_codes.MQTT_CLIENT_NOT_CONNECTED_TO_LEADER) + try: + self.pub_client.reconnect() + except Exception: + pass + try: + self.sub_client.reconnect() + except Exception: + pass + def check_for_last_backup(self) -> None: with utils.local_persistant_storage("database_backups") as cache: if cache.get("latest_backup_timestamp"): diff --git a/requirements/requirements.txt b/requirements/requirements.txt index de89fad7..3151ba72 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -5,5 +5,5 @@ sh==1.14.2 JSON-log-formatter==0.4.0 rpi_hardware_pwm==0.1.3 colorlog==6.6.0 -msgspec==0.18.0 +msgspec==0.18.1 diskcache==5.6.1 diff --git a/setup.py b/setup.py index 88fe6d09..b6535de0 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ "sh==1.14.3", "JSON-log-formatter==0.5.1", "colorlog==6.7.0", - "msgspec==0.18.0", + "msgspec==0.18.1", "diskcache==5.6.1", "wheel==0.38.4", "crudini==0.9.4", diff --git a/update_scripts/32.7.31/update.sh b/update_scripts/32.7.31/update.sh deleted file mode 100644 index ea59231c..00000000 --- a/update_scripts/32.7.31/update.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -x -set -e - -export LC_ALL=C - -wget -O /usr/local/bin/install_pioreactor_plugin.sh https://raw.githubusercontent.com/Pioreactor/CustoPiZer/13fe0f/workspace/scripts/files/bash/install_pioreactor_plugin.sh -wget -O /usr/local/bin/uninstall_pioreactor_plugin.sh https://raw.githubusercontent.com/Pioreactor/CustoPiZer/13fe0f/workspace/scripts/files/bash/uninstall_pioreactor_plugin.sh