Skip to content

Commit

Permalink
fix BP not exist while deleting a device
Browse files Browse the repository at this point in the history
  • Loading branch information
clavay authored and trombastic committed Feb 12, 2024
1 parent 067f978 commit f2866a5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pyscada/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,16 @@ def _del_daq_daemons(sender, instance, **kwargs):
label=f"pyscada.{instance.protocol.protocol}-{instance.id}",
)
except BackgroundProcess.DoesNotExist:
# for modbus protocol
bp = BackgroundProcess.objects.get(
done=False,
failed=False,
label__startswith=f"pyscada.{instance.protocol.protocol}-{instance.id}",
)
try:
# for modbus protocol
bp = BackgroundProcess.objects.get(
done=False,
failed=False,
label__startswith=f"pyscada.{instance.protocol.protocol}-{instance.id}",
)
except BackgroundProcess.DoesNotExist:
# BP not created, cannot stop
return False
except Exception as e:
logger.debug(e)
return False
Expand Down

0 comments on commit f2866a5

Please sign in to comment.