mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Handle panics that percolate up to the graceful module (#11291)
* Handle panics in graceful goroutines Adds a some deferred functions to handle panics in graceful goroutines Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle panic in webhook.Deliver Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle panic in mirror.syncMirror Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
4159866528
commit
4a04740daf
3 changed files with 50 additions and 1 deletions
|
@ -333,6 +333,14 @@ func SyncMirrors(ctx context.Context) {
|
|||
|
||||
func syncMirror(repoID string) {
|
||||
log.Trace("SyncMirrors [repo_id: %v]", repoID)
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
// There was a panic whilst syncMirrors...
|
||||
log.Error("PANIC whilst syncMirrors[%s] Panic: %v\nStacktrace: %s", repoID, err, log.Stack(2))
|
||||
}()
|
||||
mirrorQueue.Remove(repoID)
|
||||
|
||||
m, err := models.GetMirrorByRepoID(com.StrTo(repoID).MustInt64())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue