Commit b2257087 authored by Michal Čihař's avatar Michal Čihař

Retry git commit as there might be other processes accessing repository in same time

parent d797844a
......@@ -10,6 +10,8 @@ from django.core.mail import mail_admins
from django.core.exceptions import ValidationError
from glob import glob
import os
import time
import random
import os.path
import logging
import git
......@@ -351,6 +353,16 @@ class Translation(models.Model):
# No changes to commit
return False
logger.info('Commiting %s as %s', self.filename, author)
try:
gitrepo.git.commit(
self.filename,
author = author,
m = settings.COMMIT_MESSAGE
)
except git.GitCommandError:
# There might be another attempt on commit in same time
# so we will sleep a bit an retry
time.sleep(random.random() * 2)
gitrepo.git.commit(
self.filename,
author = author,
......
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