Skip to content

Commit 4971a10

Browse files
puni9869delvh
andauthored
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>
1 parent 1d8d90f commit 4971a10

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

services/webhook/webhook.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package webhook
55

66
import (
77
"context"
8+
"errors"
89
"fmt"
910
"strings"
1011

@@ -111,7 +112,11 @@ func handler(items ...int64) []int64 {
111112
for _, taskID := range items {
112113
task, err := webhook_model.GetHookTaskByID(ctx, taskID)
113114
if err != nil {
114-
log.Error("GetHookTaskByID[%d] failed: %v", taskID, err)
115+
if errors.Is(err, util.ErrNotExist) {
116+
log.Warn("GetHookTaskByID[%d] warn: %v", taskID, err)
117+
} else {
118+
log.Error("GetHookTaskByID[%d] failed: %v", taskID, err)
119+
}
115120
continue
116121
}
117122

0 commit comments

Comments
 (0)