Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Nov 12, 2024
2 parents 1969cb4 + f272884 commit 29c6776
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Not yet released.

* Fixed occasional crash in :ref:`rss`.
* :ref:`check-icu-message-format` gracefully handles plural strings.
* :ref:`vcs-bitbucket-cloud` correctly generates pull request description.

**Upgrading**

Expand Down
7 changes: 6 additions & 1 deletion weblate/utils/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from .celery import is_celery_queue_long
from .checks import weblate_check
from .classloader import ClassLoader
from .const import HEARTBEAT_FREQUENCY
from .data import data_dir
from .db import (
MySQLSearchLookup,
Expand Down Expand Up @@ -155,7 +156,11 @@ def check_celery(
heartbeat = cache.get("celery_heartbeat")
loaded = cache.get("celery_loaded")
now = time.time()
if loaded and now - loaded > 120 and (not heartbeat or now - heartbeat > 600):
if (
loaded
and now - loaded > HEARTBEAT_FREQUENCY
and (not heartbeat or now - heartbeat > HEARTBEAT_FREQUENCY * 10)
):
errors.append(
weblate_check(
"weblate.C030",
Expand Down
1 change: 1 addition & 0 deletions weblate/utils/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later

SUPPORT_STATUS_CACHE_KEY = "weblate:support:status"
HEARTBEAT_FREQUENCY = 120
4 changes: 3 additions & 1 deletion weblate/utils/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from weblate.utils.lock import WeblateLockTimeoutError
from weblate.vcs.models import VCS_REGISTRY

from .const import HEARTBEAT_FREQUENCY


@app.task(trail=False)
def ping():
Expand Down Expand Up @@ -178,4 +180,4 @@ def setup_periodic_tasks(sender, **kwargs) -> None:
sender.add_periodic_task(
crontab(hour=1, minute=30), database_backup.s(), name="database-backup"
)
sender.add_periodic_task(120, heartbeat.s(), name="heartbeat")
sender.add_periodic_task(HEARTBEAT_FREQUENCY, heartbeat.s(), name="heartbeat")

0 comments on commit 29c6776

Please sign in to comment.