Skip to content

Commit

Permalink
Fix: Handle missing resolved_middleware in asset_updates.py (#2087)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 authored Apr 15, 2024
1 parent 830a82b commit ee3052f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion care/facility/signals/asset_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def save_asset_fields_before_update(
sender, instance, raw, using, update_fields, **kwargs
):
if raw:
if raw or instance.resolved_middleware is None:
return

if instance.pk:
Expand Down Expand Up @@ -45,5 +45,7 @@ def update_asset_config_on_middleware(

@receiver(post_delete, sender=Asset)
def delete_asset_on_middleware(sender, instance, using, **kwargs):
if instance.resolved_middleware is None:
return
hostname = instance.resolved_middleware.get("hostname")
delete_asset_from_middleware_task.s(hostname, instance.external_id)

0 comments on commit ee3052f

Please sign in to comment.