improve manual reconnecting
This commit is contained in:
@@ -16,7 +16,6 @@ from gotify_tray.tasks import (
|
|||||||
GetApplicationMessagesTask,
|
GetApplicationMessagesTask,
|
||||||
GetMessagesTask,
|
GetMessagesTask,
|
||||||
ServerConnectionWatchdogTask,
|
ServerConnectionWatchdogTask,
|
||||||
SleepTask,
|
|
||||||
)
|
)
|
||||||
from gotify_tray.utils import get_abs_path, verify_server
|
from gotify_tray.utils import get_abs_path, verify_server
|
||||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||||
@@ -133,9 +132,9 @@ class MainApplication(QtWidgets.QApplication):
|
|||||||
self.tray.set_icon_error()
|
self.tray.set_icon_error()
|
||||||
if not self.shutting_down:
|
if not self.shutting_down:
|
||||||
self.gotify_client.increase_wait_time()
|
self.gotify_client.increase_wait_time()
|
||||||
self.sleep_task = SleepTask(self.gotify_client.get_wait_time())
|
QtCore.QTimer.singleShot(
|
||||||
self.sleep_task.finished.connect(self.gotify_client.reconnect)
|
self.gotify_client.get_wait_time() * 1000, self.gotify_client.reconnect
|
||||||
self.sleep_task.start()
|
)
|
||||||
|
|
||||||
def reconnect_callback(self):
|
def reconnect_callback(self):
|
||||||
if not self.gotify_client.is_listening():
|
if not self.gotify_client.is_listening():
|
||||||
|
|||||||
@@ -175,12 +175,3 @@ class ServerConnectionWatchdogTask(BaseTask):
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
"ServerConnectionWatchdogTask: gotify_client is not listening"
|
"ServerConnectionWatchdogTask: gotify_client is not listening"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SleepTask(BaseTask):
|
|
||||||
def __init__(self, secs: int):
|
|
||||||
super(SleepTask, self).__init__()
|
|
||||||
self.secs = secs
|
|
||||||
|
|
||||||
def task(self):
|
|
||||||
time.sleep(self.secs)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user