fix(scheduler): address !7 REQUEST_CHANGES

- seed: check completed_key before no_source so same-day last_completed
  is already_completed (not 10m retry)
- scheduler: resolve TaskControl ok/error before logging; ok=False logs
  task_fail, not task_ok
- candidate_cleanup: catch failures, record task, retry ~5m like discover
This commit is contained in:
bot-ci committed 2026-11-03 01:08:34 +08:00
1 parent bb18d232f6
commit 1697573d95
7 files changed
+264 -17

No files matched your search

+17 -2
View File
@@ -87,11 +87,9 @@ class Scheduler:
raw = task.fn()
except Exception as exc: # noqa: BLE001 单任务失败不终止调度
error = str(exc)
self._log("error", "scheduler.task_error", task=task.name, error=error)
else:
if isinstance(raw, TaskControl):
control = raw
self._log("info", "scheduler.task_ok", task=task.name)
finished = self._clock()
if control is not None and control.next_run is not None:
task.next_run = float(control.next_run)
@@ -104,6 +102,23 @@ class Scheduler:
ok = bool(control.ok) and error is None
if control.error and error is None:
error = control.error
# Skip/fail ≠ success:先定 ok/error,再记 scheduler 日志。
if ok:
self._log("info", "scheduler.task_ok", task=task.name)
elif control is not None:
self._log(
"warning",
"scheduler.task_fail",
task=task.name,
error=error,
)
else:
self._log(
"error",
"scheduler.task_error",
task=task.name,
error=error,
)
result = TaskResult(
name=task.name,
started_at=started,