mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08: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:
		@@ -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())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user