Skip to content

Commit

Permalink
Utils: Fix threshold for translate queue
Browse files Browse the repository at this point in the history
There is a task for every translation, so adjust threshold accordingly.
  • Loading branch information
nijel committed Jan 29, 2021
1 parent 6598720 commit e7e4e4f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions weblate/utils/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def is_celery_queue_long():
filtered out, and no warning need be issued for big operations (for example
site-wide autotranslation).
"""
from weblate.trans.models import Component
from weblate.trans.models import Translation

cache_key = "celery_queue_stats"
queues_data = cache.get(cache_key, {})
Expand Down Expand Up @@ -171,7 +171,7 @@ def is_celery_queue_long():
thresholds = defaultdict(lambda: 50)
# Set the limit to avoid trigger on auto-translating all components
# nightly.
thresholds["translate"] = max(1000, Component.objects.count() / 30)
thresholds["translate"] = max(1000, Translation.objects.count() / 30)
return any(
stat > thresholds[key] and base.get(key, 0) > thresholds[key]
for key, stat in stats.items()
Expand Down

0 comments on commit e7e4e4f

Please sign in to comment.