ensure that only existing storage units are removed

This commit is contained in:
wakonig_k 2022-09-16 21:12:27 +02:00
parent 405ef35788
commit ef01f03bcf

View File

@ -311,7 +311,7 @@ class ScanBundler(BECService):
time.sleep(0.1) time.sleep(0.1)
elapsed_time += 0.1 elapsed_time += 0.1
if elapsed_time > timeout_time: if elapsed_time > timeout_time:
logger.error( logger.warning(
f"Failed to insert device data for {device} to sync_storage: Could not find a matching scanID {scanID} in sync_storage." f"Failed to insert device data for {device} to sync_storage: Could not find a matching scanID {scanID} in sync_storage."
) )
return return
@ -430,12 +430,18 @@ class ScanBundler(BECService):
remove_scanIDs.append(scanID) remove_scanIDs.append(scanID)
for scanID in remove_scanIDs: for scanID in remove_scanIDs:
self.sync_storage.pop(scanID) for storage in [
self.bluesky_metadata.pop(scanID) "sync_storage",
self.primary_devices.pop(scanID) "bluesky_metadata",
self.monitor_devices.pop(scanID) "primary_devices",
self.baseline_devices.pop(scanID) "monitor_devices",
self.scan_motors.pop(scanID) "baseline_devices",
"scan_motors",
]:
try:
getattr(self, storage).pop(scanID)
except KeyError:
logger.warning(f"Failed to remove {scanID} from {storage}.")
self.storage_initialized.remove(scanID) self.storage_initialized.remove(scanID)
def _send_scan_point(self, scanID, pointID) -> None: def _send_scan_point(self, scanID, pointID) -> None: