aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpuni9869 <80308335+puni9869@users.noreply.github.com>2023-07-28 23:16:48 +0530
committerGitHub <noreply@github.com>2023-07-28 17:46:48 +0000
commit4971a1054317ae68b1eb59a3dc30f61c7503dadc (patch)
tree63e9457e6283f30ad3b37c332a9a90e5ab4b8947
parent1d8d90fd3727ffdf0500c8dd474b85e0c285d064 (diff)
downloadgitea-4971a1054317ae68b1eb59a3dc30f61c7503dadc.tar.gz
gitea-4971a1054317ae68b1eb59a3dc30f61c7503dadc.zip
Warn instead of reporting an error when a webhook cannot be found (#26039)
Attemp fix: #25744 Fixing the log level when we delete any repo then we get error hook not found by id. That should be warn level to reduce the noise in the logs. --------- Co-authored-by: delvh <dev.lh@web.de>
-rw-r--r--services/webhook/webhook.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/webhook/webhook.go b/services/webhook/webhook.go
index 3cd9deafd8..9d5dab85f7 100644
--- a/services/webhook/webhook.go
+++ b/services/webhook/webhook.go
@@ -5,6 +5,7 @@ package webhook
import (
"context"
+ "errors"
"fmt"
"strings"
@@ -111,7 +112,11 @@ func handler(items ...int64) []int64 {
for _, taskID := range items {
task, err := webhook_model.GetHookTaskByID(ctx, taskID)
if err != nil {
- log.Error("GetHookTaskByID[%d] failed: %v", taskID, err)
+ if errors.Is(err, util.ErrNotExist) {
+ log.Warn("GetHookTaskByID[%d] warn: %v", taskID, err)
+ } else {
+ log.Error("GetHookTaskByID[%d] failed: %v", taskID, err)
+ }
continue
}