diff --git a/weblate/addons/base.py b/weblate/addons/base.py index 0cd24fb954a9..0020b3808e1f 100644 --- a/weblate/addons/base.py +++ b/weblate/addons/base.py @@ -437,9 +437,10 @@ def post_update( self, component: Component, previous_head: str, skip_push: bool ) -> None: # Ignore file parse error, it will be properly tracked as an alert - with suppress(FileParseError): - self.update_translations(component, previous_head) - self.commit_and_push(component, skip_push=skip_push) + with component.repository.lock: + with suppress(FileParseError): + self.update_translations(component, previous_head) + self.commit_and_push(component, skip_push=skip_push) class StoreBaseAddon(BaseAddon): diff --git a/weblate/trans/models/component.py b/weblate/trans/models/component.py index cf009444f018..8be4a614012c 100644 --- a/weblate/trans/models/component.py +++ b/weblate/trans/models/component.py @@ -106,10 +106,12 @@ from weblate.vcs.ssh import add_host_key if TYPE_CHECKING: + from collections.abc import Iterable from datetime import datetime from weblate.addons.models import Addon from weblate.auth.models import AuthenticatedHttpRequest, User + from weblate.checks.base import BaseCheck from weblate.trans.models import Unit NEW_LANG_CHOICES = ( @@ -3747,7 +3749,7 @@ def _schedule_sync_terminology(self) -> None: for glossary in self.project.glossaries: sync_glossary_languages.delay(glossary.pk) - def get_unused_enforcements(self): + def get_unused_enforcements(self) -> Iterable[dict | BaseCheck]: from weblate.trans.models import Unit for current in self.enforced_checks: @@ -3755,6 +3757,7 @@ def get_unused_enforcements(self): check = CHECKS[current] except KeyError: yield {"name": current, "notsupported": True} + continue # Check is always enabled if not check.default_disabled: continue