Skip to content

Commit c5fe09d

Browse files
GiteaBotpuni9869
andauthored
Warn instead of reporting an error when a webhook cannot be found (#26039) (#26211)
Backport #26039 by @puni9869 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: puni9869 <80308335+puni9869@users.noreply.github.com>
1 parent 0981411 commit c5fe09d

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)