Skip to content

Commit

Permalink
Merge pull request #208 from xuzhu-591/fix-duplicated-webhook
Browse files Browse the repository at this point in the history
fix: improve recover log
  • Loading branch information
xuzhu-591 authored Dec 28, 2023
2 parents aa5e0fa + e9961be commit de79c13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions pkg/eventhandler/eventhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package eventhandler

import (
"context"
"runtime/debug"
"time"

corecommon "github.com/horizoncd/horizon/core/common"
Expand All @@ -26,7 +27,6 @@ import (
eventmanager "github.com/horizoncd/horizon/pkg/event/manager"
"github.com/horizoncd/horizon/pkg/event/models"
"github.com/horizoncd/horizon/pkg/param/managerparam"
"github.com/horizoncd/horizon/pkg/util/common"
"github.com/horizoncd/horizon/pkg/util/log"
webhookmanager "github.com/horizoncd/horizon/pkg/webhook/manager"
)
Expand Down Expand Up @@ -92,8 +92,7 @@ func (e *eventHandlerService) Start() {
go func() {
defer func() {
if err := recover(); err != nil {
log.Errorf(e.ctx, "event handler service panic: %v", err)
common.PrintStack()
log.Errorf(e.ctx, "event handler service panic: %s", string(debug.Stack()))
}
}()

Expand Down
8 changes: 3 additions & 5 deletions pkg/webhook/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"io"
"io/ioutil"
"net/http"
"runtime/debug"
"sync"
"sync/atomic"
"time"
Expand All @@ -34,7 +35,6 @@ import (
"github.com/horizoncd/horizon/pkg/eventhandler/wlgenerator"
"github.com/horizoncd/horizon/pkg/param/managerparam"
usermanager "github.com/horizoncd/horizon/pkg/user/manager"
"github.com/horizoncd/horizon/pkg/util/common"
"github.com/horizoncd/horizon/pkg/util/log"
webhookmanager "github.com/horizoncd/horizon/pkg/webhook/manager"
"github.com/horizoncd/horizon/pkg/webhook/models"
Expand Down Expand Up @@ -153,8 +153,7 @@ func (s *service) Start() {
go func() {
defer func() {
if err := recover(); err != nil {
log.Errorf(s.ctx, "webhook service reconcile panic: %v", err)
common.PrintStack()
log.Errorf(s.ctx, "webhook service reconcile panic: %s", string(debug.Stack()))
}
}()

Expand Down Expand Up @@ -286,8 +285,7 @@ func (w *worker) start() {
ctx := w.ctx
defer func() {
if err := recover(); err != nil {
log.Errorf(ctx, "webhook worker panic: %v", err)
common.PrintStack()
log.Errorf(ctx, "webhook worker panic: %s", string(debug.Stack()))
}
}()
L:
Expand Down

0 comments on commit de79c13

Please sign in to comment.