首页 > 解决方案 > django_cron 似乎没有锁定任务

问题描述

我正在使用 django 1.10 和 django_cron 包(0.5.0)。

该软件包默认情况下会在任务运行时锁定任务,因此它不会在其他服务器上运行。似乎在我们的项目中(托管在 3 个服务器上) - 它每小时运行 3 次(这是时间表)我没有更改配置中的任何内容,因为我知道它应该默认锁定任务。

这是任务:

class CreateMissingItems(CronJobBase):
    RUN_EVERY_MINS = 60

    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
    code = 'CreateMissingItems'  # a unique id

    def do(self):
        MyLog().info(message="Starting scheduled task of creating missing items")
        call_command('create_missing_items')

crontab 任务基本上每 20 分钟运行一次。我错过了什么吗?

标签: pythondjangocrondjango-cron

解决方案


推荐阅读