diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-10-27 13:55:43 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:23:19 +0100 |
commit | 9589747a947df6550729b6adae89618aa7839f4e (patch) | |
tree | 63b34c04e9adf4088384240cbf50500bfc26d2fc /archaeological_context_records/models.py | |
parent | 7ab38503a2450b11e72ed28445b080e5a6cf27f4 (diff) | |
download | Ishtar-9589747a947df6550729b6adae89618aa7839f4e.tar.bz2 Ishtar-9589747a947df6550729b6adae89618aa7839f4e.zip |
Geodata save: transaction for main_geodata assignation to limit deadlocks
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
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, |