1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 10:04:27 +00:00
gitea/services/cron
Giteabot 6f4d5c0b8c
Recover from panic in cron task (#28409) (#28425)
Backport #28409 by @earl-warren

- Currently there's code to recover gracefully from panics that happen
within the execution of cron tasks. However this recover code wasn't
being run, because `RunWithShutdownContext` also contains code to
recover from any panic and then gracefully shutdown Forgejo. Because
`RunWithShutdownContext` registers that code as last, that would get run
first which in this case is not behavior that we want.
- Move the recover code to inside the function, so that is run first
before `RunWithShutdownContext`'s recover code (which is now a noop).

Fixes: https://codeberg.org/forgejo/forgejo/issues/1910

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-12-12 03:28:56 +00:00
..
cron.go Fix data-race bug when accessing task.LastRun (#27584) (#27586) 2023-10-11 15:27:38 +00:00
setting.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
tasks_actions.go chore(actions): support cron schedule task (#26655) 2023-08-24 03:06:51 +00:00
tasks_basic.go Artifacts retention and auto clean up (#26131) 2023-09-06 07:41:06 +00:00
tasks_extended.go Improve retrying index issues (#27554) (#27634) 2023-10-16 09:55:53 +08:00
tasks_test.go Replace gogs/cron with go-co-op/gocron (#25977) 2023-07-24 04:13:41 +00:00
tasks.go Recover from panic in cron task (#28409) (#28425) 2023-12-12 03:28:56 +00:00