()
| 76 | |
| 77 | # Github 监控任务调度,有个循环 |
| 78 | def github_task_scheduler(): |
| 79 | items = list(utils.conn_db('github_scheduler').find()) |
| 80 | for item in items: |
| 81 | try: |
| 82 | if item["status"] != SchedulerStatus.RUNNING: |
| 83 | continue |
| 84 | |
| 85 | entry = CronTab(item["cron"]) |
| 86 | next_sec = entry.next(default_utc=False) |
| 87 | if next_sec < 60 and abs(time.time() - item["last_run_time"]) > 60*3: |
| 88 | logger.info("github_cron_run {} {}".format(item["keyword"], str(item["_id"]))) |
| 89 | github_cron_run(item) |
| 90 | |
| 91 | except Exception as e: |
| 92 | logger.exception(e) |
| 93 | |
| 94 | |
| 95 | def find_github_scheduler(_id): |
no test coverage detected