Skip to content

Commit

Permalink
fix(worker): added worker lost wait in worker
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Feb 10, 2025
1 parent 26538a8 commit d0d0034
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions API/api_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from src.config import CELERY_BROKER_URL as celery_broker_uri
from src.config import CELERY_RESULT_BACKEND as celery_backend
from src.config import (
CELERY_WORKER_LOST_WAIT,
DEFAULT_HARD_TASK_LIMIT,
DEFAULT_README_TEXT,
DEFAULT_SOFT_TASK_LIMIT,
Expand Down Expand Up @@ -51,6 +52,7 @@
celery.conf.broker_url = celery_broker_uri
celery.conf.result_backend = celery_backend
celery.conf.broker_heartbeat = CELERY_BROKER_HEARTBEAT
celery.conf.worker_lost_wait = CELERY_WORKER_LOST_WAIT
# celery.conf.task_serializer = "pickle"
# celery.conf.result_serializer = "json"
# celery.conf.accept_content = ["application/json", "application/x-python-serialize"]
Expand Down
4 changes: 4 additions & 0 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def get_bool_env_var(key, default=False):
CELERY_BROKER_HEARTBEAT = os.environ.get("CELERY_BROKER_HEARTBEAT") or config.get(
"CELERY", "CELERY_BROKER_HEARTBEAT", fallback=120
)
CELERY_WORKER_LOST_WAIT = os.environ.get("CELERY_WORKER_LOST_WAIT") or config.get(
"CELERY", "CELERY_WORKER_LOST_WAIT ", fallback=10
)

WORKER_PREFETCH_MULTIPLIER = int(
os.environ.get("WORKER_PREFETCH_MULTIPLIER")
or config.get("CELERY", "WORKER_PREFETCH_MULTIPLIER", fallback=1)
Expand Down

0 comments on commit d0d0034

Please sign in to comment.