From 998f58d3fa176770bf357374fc1636e6860ab1cb Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 13 Aug 2019 15:19:30 +0200 Subject: [PATCH] Tweak offline check interval for cloud device --- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 8 ++++++-- .../src/UltimakerNetworkedPrinterOutputDevice.py | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index fc514d1fca..fbd0ea4e2c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -42,7 +42,11 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): # The interval with which the remote cluster is checked. # We can do this relatively often as this API call is quite fast. - CHECK_CLUSTER_INTERVAL = 8.0 # seconds + CHECK_CLUSTER_INTERVAL = 10.0 # seconds + + # Override the network response timeout in seconds after which we consider the device offline. + # For cloud this needs to be higher because the interval at which we check the status is higher as well. + NETWORK_RESPONSE_CONSIDER_OFFLINE = 15.0 # seconds # The minimum version of firmware that support print job actions over cloud. PRINT_JOB_ACTIONS_MIN_VERSION = Version("5.3.0") @@ -274,7 +278,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): @clusterData.setter def clusterData(self, value: CloudClusterResponse) -> None: self._cluster = value - + ## Gets the URL on which to monitor the cluster via the cloud. @property def clusterCloudUrl(self) -> str: diff --git a/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py index f2c24e4802..9230ed8a56 100644 --- a/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py @@ -26,7 +26,7 @@ from .Models.Http.ClusterPrintJobStatus import ClusterPrintJobStatus # Currently used for local networking and cloud printing using Ultimaker Connect. # This base class primarily contains all the Qt properties and slots needed for the monitor page to work. class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice): - + META_NETWORK_KEY = "um_network_key" META_CLUSTER_ID = "um_cloud_cluster_id" @@ -42,10 +42,10 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice): # States indicating if a print job is queued. QUEUED_PRINT_JOBS_STATES = {"queued", "error"} - + # Time in seconds since last network response after which we consider this device offline. # We set this a bit higher than some of the other intervals to make sure they don't overlap. - NETWORK_RESPONSE_CONSIDER_OFFLINE = 12.0 + NETWORK_RESPONSE_CONSIDER_OFFLINE = 10.0 # seconds def __init__(self, device_id: str, address: str, properties: Dict[bytes, bytes], connection_type: ConnectionType, parent=None) -> None: @@ -54,7 +54,7 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice): # Trigger the printersChanged signal when the private signal is triggered. self.printersChanged.connect(self._clusterPrintersChanged) - + # Keeps track the last network response to determine if we are still connected. self._time_of_last_response = time()