V
V
Vampre2019-03-10 06:08:36
Django
Vampre, 2019-03-10 06:08:36

Why does the task run in all workers at once?

I'm trying to schedule tasks to run using Cron Jobs rq-scheduler: https://github.com/rq/rq-scheduler

scheduler = django_rq.get_scheduler('default')
scheduler.cron(
    "10 * * * *",
    func='jobparser.tasks.parse',
    queue_name='default',
)

The problem is that if more than one worker is running, then this task gets into all of them at once. At the same time, if you run it not through the scheduler, but manually, then everything is OK - the task is launched once in one of the workers: Am I doing something wrong or is this normal behavior and should I just allocate a separate queue with one worker for such cron tasks?
django_rq.enqueue('jobparser.tasks.parse')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question