mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Fix status interval check for cloud devices
This commit is contained in:
parent
00334ee5a9
commit
e6d30516aa
2 changed files with 6 additions and 5 deletions
|
@ -148,8 +148,9 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
## Called when the network data should be updated.
|
||||
def _update(self) -> None:
|
||||
super()._update()
|
||||
if self._last_request_time and time() - self._last_request_time < self.CHECK_CLUSTER_INTERVAL:
|
||||
return # Avoid calling the cloud too often
|
||||
if time() - self._time_of_last_request < self.CHECK_CLUSTER_INTERVAL:
|
||||
return # avoid calling the cloud too often
|
||||
self._time_of_last_request = time()
|
||||
if self._account.isLoggedIn:
|
||||
self.setAuthenticationState(AuthState.Authenticated)
|
||||
self._last_request_time = time()
|
||||
|
@ -160,9 +161,8 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
## Method called when HTTP request to status endpoint is finished.
|
||||
# Contains both printers and print jobs statuses in a single response.
|
||||
def _onStatusCallFinished(self, status: CloudClusterStatus) -> None:
|
||||
# Update all data from the cluster.
|
||||
self._last_response_time = time()
|
||||
if self._received_printers != status.printers:
|
||||
self._responseReceived()
|
||||
if status.printers != self._received_printers:
|
||||
self._received_printers = status.printers
|
||||
self._updatePrinters(status.printers)
|
||||
if status.print_jobs != self._received_print_jobs:
|
||||
|
|
|
@ -57,6 +57,7 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
|
|||
|
||||
# Keeps track the last network response to determine if we are still connected.
|
||||
self._time_of_last_response = time()
|
||||
self._time_of_last_request = time()
|
||||
|
||||
# Set the display name from the properties
|
||||
self.setName(self.getProperty("name"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue