cron: log and capture exceptions, do not create logged errors (#88783)
gitea/wcs/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2024-03-27 14:24:45 +01:00
parent dc473b7378
commit 3501733920
1 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,7 @@
import datetime
import os
import sys
import time
from contextlib import contextmanager
@ -128,4 +129,5 @@ def cron_worker(publisher, since, job_name=None):
with job.log_long_job():
job.function(publisher, job=job)
except Exception as e:
publisher.record_error(exception=e, context='[CRON]', notify=True)
job.log(f'exception running job {job.name}: {e}')
publisher.capture_exception(sys.exc_info())