From 9589747a947df6550729b6adae89618aa7839f4e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 27 Oct 2022 13:55:43 +0200 Subject: Geodata save: transaction for main_geodata assignation to limit deadlocks --- archaeological_context_records/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archaeological_context_records') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 55b101acc..09733b566 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -25,7 +25,7 @@ from django.conf import settings from django.contrib.gis.db import models from django.contrib.postgres.indexes import GinIndex from django.contrib.sites.models import Site -from django.db import connection, IntegrityError, transaction +from django.db import connection, transaction, OperationalError, IntegrityError from django.db.models import Q from django.db.models.signals import post_delete, post_save, m2m_changed from django.urls import reverse @@ -461,7 +461,7 @@ class GeographicSubTownItem(GeoItem): # multiple save, post treatments can cause synchronous add with transaction.atomic(): self.geodata.add(town.main_geodata) - except IntegrityError: + except (OperationalError, IntegrityError): pass if save: post_save_geo(self.__class__, instance=self, created=False, -- cgit v1.2.3