Commit 5f79a7f9 authored by Alexander Pace's avatar Alexander Pace
Browse files

reworked retry logic

parent accacadf
Pipeline #206285 passed with stages
in 14 minutes and 55 seconds
......@@ -132,13 +132,14 @@ class AutoIncrementModel(models.Model):
try:
self.full_clean()
super(AutoIncrementModel, self).save(*args, **kwargs)
break
except IntegrityError as e:
logger.warning("Database integrity error when saving {}. ",
"Incrementing and retrying.".format(self))
setattr(self, self.AUTO_FIELD,
getattr(self,self.AUTO_FIELD) + 1)
this_try += 1
else:
break
def auto_increment_update(self, update_field_name, constraints=[],
allow_update_to_nonnull=False):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment