(_id)
| 121 | |
| 122 | # 恢复 Github 监控任务,只是改变状态 |
| 123 | def recover_task(_id): |
| 124 | from app.modules import SchedulerStatus |
| 125 | if len(_id) != 24: |
| 126 | return |
| 127 | |
| 128 | item = find_github_scheduler(_id) |
| 129 | item["status"] = SchedulerStatus.RUNNING |
| 130 | entry = CronTab(item["cron"]) |
| 131 | next_sec = entry.next(default_utc=False) |
| 132 | item["next_run_date"] = utils.time2date(time.time() + next_sec) |
| 133 | |
| 134 | query = { |
| 135 | "_id": ObjectId(_id) |
| 136 | } |
| 137 | utils.conn_db('github_scheduler').find_one_and_replace(query, item) |
| 138 | |
| 139 | |
| 140 | # 停止Github 监控任务,只是改变状态 |
nothing calls this directly
no test coverage detected