fix: added scan status messages for halted and paused

This commit is contained in:
wakonig_k 2023-03-12 11:52:03 +01:00
parent cb3ce8b91b
commit c239c41394

View File

@ -388,6 +388,8 @@ class ScanWorker(threading.Thread):
)
def _check_for_interruption(self) -> None:
if self.status == InstructionQueueStatus.PAUSED:
self._send_scan_status("paused")
while self.status == InstructionQueueStatus.PAUSED:
time.sleep(0.1)
if self.status == InstructionQueueStatus.STOPPED:
@ -499,7 +501,7 @@ class ScanWorker(threading.Thread):
status=status,
info=self.current_scan_info,
).dumps()
expire = None if status == "open" else 1800
expire = None if status in ["open", "paused"] else 1800
pipe = self.device_manager.producer.pipeline()
self.device_manager.producer.set(
MessageEndpoints.public_scan_info(self.current_scanID), msg, pipe=pipe, expire=expire
@ -627,7 +629,10 @@ class ScanWorker(threading.Thread):
except ScanAbortion:
queue.queue.increase_scan_number()
self._send_scan_status("aborted")
if queue.return_to_start:
self._send_scan_status("aborted")
else:
self._send_scan_status("halted")
queue.status = InstructionQueueStatus.STOPPED
queue.append_to_queue_history()
self.cleanup()