From e36050d8fd806a39733d12235ceff6a848fcab07 Mon Sep 17 00:00:00 2001 From: Aidaho Date: Sun, 27 Apr 2025 19:51:54 +0300 Subject: [PATCH] v8.1.8: Refactor error handling, cleanup unused variables, and fix intervals Removed unnecessary error handling logic and unused `error_mess` variables. Adjusted HA cluster polling interval from 10 minutes to 1 minute for better responsiveness. Cleaned up redundant HTML elements and ensured consistent coding practices across files. --- app/modules/db/channel.py | 2 +- app/modules/server/ssh.py | 2 -- app/modules/tools/alerting.py | 2 -- app/routes/ha/routes.py | 2 +- app/templates/ha_cluster.html | 12 +----------- 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/app/modules/db/channel.py b/app/modules/db/channel.py index 2827bd16..2d25d747 100644 --- a/app/modules/db/channel.py +++ b/app/modules/db/channel.py @@ -73,8 +73,8 @@ def delete_receiver(receiver: str, channel_id: int) -> None: def get_receiver_with_group(receiver: str, channel_id: int, group_id: int): + model = models[receiver] try: - model = models[receiver] return model.get((model.id == channel_id) & (model.group_id == group_id)) except model.DoesNotExist: raise RoxywiResourceNotFound diff --git a/app/modules/server/ssh.py b/app/modules/server/ssh.py index 69653be9..1c51871e 100644 --- a/app/modules/server/ssh.py +++ b/app/modules/server/ssh.py @@ -8,14 +8,12 @@ from playhouse.shortcuts import model_to_dict import app.modules.db.cred as cred_sql import app.modules.db.group as group_sql import app.modules.db.server as server_sql -import app.modules.common.common as common from app.modules.server import ssh_connection from app.modules.db.db_model import Cred import app.modules.roxywi.common as roxywi_common import app.modules.roxy_wi_tools as roxy_wi_tools from app.modules.roxywi.class_models import IdResponse, IdDataResponse, CredRequest -error_mess = common.error_mess get_config = roxy_wi_tools.GetConfigVar() diff --git a/app/modules/tools/alerting.py b/app/modules/tools/alerting.py index 3cccc094..6918a744 100644 --- a/app/modules/tools/alerting.py +++ b/app/modules/tools/alerting.py @@ -16,8 +16,6 @@ import app.modules.db.checker as checker_sql import app.modules.common.common as common import app.modules.roxywi.common as roxywi_common -error_mess = common.error_mess - def send_message_to_rabbit(message: str, **kwargs) -> None: rabbit_user = sql.get_setting('rabbitmq_user') diff --git a/app/routes/ha/routes.py b/app/routes/ha/routes.py index 8b235cce..7046114d 100644 --- a/app/routes/ha/routes.py +++ b/app/routes/ha/routes.py @@ -172,4 +172,4 @@ def check_cluster_status(service: str, cluster_id: int): elif 'inactive' in statuses and 'active' not in statuses: status = 'error' - return jsonify({'status': status}) \ No newline at end of file + return jsonify({'status': status}) diff --git a/app/templates/ha_cluster.html b/app/templates/ha_cluster.html index 2347f8dc..b169843c 100644 --- a/app/templates/ha_cluster.html +++ b/app/templates/ha_cluster.html @@ -184,20 +184,10 @@ - {% endif %}