Skip to content

Commit

Permalink
fix(worker): fixes bug on the heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Feb 10, 2025
1 parent eef1125 commit 26538a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion API/api_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Reader imports
from src.app import CustomExport, PolygonStats, RawData, S3FileTransfer
from src.config import ALLOW_BIND_ZIP_FILTER
from src.config import ALLOW_BIND_ZIP_FILTER, CELERY_BROKER_HEARTBEAT
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 (
Expand Down Expand Up @@ -50,6 +50,7 @@
celery = Celery("Raw Data API")
celery.conf.broker_url = celery_broker_uri
celery.conf.result_backend = celery_backend
celery.conf.broker_heartbeat = CELERY_BROKER_HEARTBEAT
# celery.conf.task_serializer = "pickle"
# celery.conf.result_serializer = "json"
# celery.conf.accept_content = ["application/json", "application/x-python-serialize"]
Expand Down
3 changes: 3 additions & 0 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def get_bool_env_var(key, default=False):
"CELERY", "CELERY_RESULT_BACKEND", fallback="redis://localhost:6379"
)

CELERY_BROKER_HEARTBEAT = os.environ.get("CELERY_BROKER_HEARTBEAT") or config.get(
"CELERY", "CELERY_BROKER_HEARTBEAT", fallback=120
)
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 26538a8

Please sign in to comment.