models.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:mist.api 作者: mistio 项目源码 文件源码
def add(cls, machine, interval=None, ttl=300):
        try:
            schedule = cls.objects.get(machine_id=machine.id)
        except cls.DoesNotExist:
            schedule = cls(machine_id=machine.id)
            try:
                schedule.save()
            except me.NotUniqueError:
                # Work around race condition where schedule was created since
                # last time we checked.
                schedule = cls.objects.get(machine_id=machine.id)
        schedule.set_default_interval(60 * 60 * 2)
        if interval is not None:
            schedule.add_interval(interval, ttl)
        schedule.run_immediately = True
        schedule.cleanup_expired_intervals()
        schedule.save()
        return schedule
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号