diff --git a/ietf/blobdb/models.py b/ietf/blobdb/models.py index d97c887b86..8f423d9f6c 100644 --- a/ietf/blobdb/models.py +++ b/ietf/blobdb/models.py @@ -65,18 +65,20 @@ class Meta: ] def save(self, **kwargs): - with transaction.atomic(using=get_blobdb()): + db = get_blobdb() + with transaction.atomic(using=db): self.checksum = sha384(self.content, usedforsecurity=False).hexdigest() super().save(**kwargs) - self._emit_blob_change_event() + self._emit_blob_change_event(using=db) def delete(self, **kwargs): - with transaction.atomic(using=get_blobdb()): + db = get_blobdb() + with transaction.atomic(using=db): retval = super().delete(**kwargs) - self._emit_blob_change_event() + self._emit_blob_change_event(using=db) return retval - def _emit_blob_change_event(self): + def _emit_blob_change_event(self, using=None): if not replication_enabled(self.bucket): return @@ -90,6 +92,7 @@ def _emit_blob_change_event(self): "name": self.name, "bucket": self.bucket, } - ), - ) + ) + ), + using=using, )