Skip to content

Commit

Permalink
Warn instead of reporting an error when a webhook cannot be found (#2…
Browse files Browse the repository at this point in the history
…6039)

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>
  • Loading branch information
puni9869 and delvh committed Jul 28, 2023
1 parent 1d8d90f commit 4971a10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion services/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package webhook

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 4971a10

Please sign in to comment.