mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Don't crash when trying to upload two jobs at the same time
This will now result in a job being put in the queue but not automatically printing, but there is at least a workaround for that. Fixes Sentry issue CURA-14A.
This commit is contained in:
parent
afb29724ff
commit
d021fd10fb
1 changed files with 9 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (c) 2019 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from time import time
|
from time import time
|
||||||
import os
|
import os
|
||||||
from typing import List, Optional, cast
|
from typing import List, Optional, cast
|
||||||
|
@ -228,10 +229,16 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
||||||
self._onUploadError)
|
self._onUploadError)
|
||||||
|
|
||||||
def _onPrintJobUploaded(self) -> None:
|
def _onPrintJobUploaded(self) -> None:
|
||||||
"""Requests the print to be sent to the printer when we finished uploading the mesh."""
|
"""
|
||||||
|
Requests the print to be sent to the printer when we finished uploading
|
||||||
|
the mesh.
|
||||||
|
"""
|
||||||
|
|
||||||
self._progress.update(100)
|
self._progress.update(100)
|
||||||
print_job = cast(CloudPrintJobResponse, self._uploaded_print_job)
|
print_job = cast(CloudPrintJobResponse, self._uploaded_print_job)
|
||||||
|
if not print_job: # It's possible that another print job is requested in the meanwhile, which then fails to upload with an error, which sets self._uploaded_print_job to `None`.
|
||||||
|
# TODO: Maybe _onUploadError shouldn't set the _uploaded_print_job to None or we need to prevent such asynchronous cases.
|
||||||
|
return # Prevent a crash.
|
||||||
self._api.requestPrint(self.key, print_job.job_id, self._onPrintUploadCompleted)
|
self._api.requestPrint(self.key, print_job.job_id, self._onPrintUploadCompleted)
|
||||||
|
|
||||||
def _onPrintUploadCompleted(self, response: CloudPrintResponse) -> None:
|
def _onPrintUploadCompleted(self, response: CloudPrintResponse) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue