Skip to content

Commit

Permalink
parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoacierno committed Mar 9, 2024
1 parent 1ba8f25 commit cf02107
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/pycon/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,5 @@
X_FRAME_OPTIONS = "SAMEORIGIN"

CELERY_TASK_IGNORE_RESULT = True

PYTEST_XDIST_WORKER = env("PYTEST_XDIST_WORKER", default="")
4 changes: 4 additions & 0 deletions backend/schedule/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ def lock_task(func):
def wrapper(*args, **kwargs):
timeout = 60 * 5
lock_id = f"celery_lock_{func.__name__}"

if settings.PYTEST_XDIST_WORKER:
lock_id = f"{lock_id}_{settings.PYTEST_XDIST_WORKER}"

client = redis.Redis.from_url(settings.REDIS_URL)
lock = client.lock(lock_id, timeout=timeout, thread_local=False)

Expand Down

0 comments on commit cf02107

Please sign in to comment.