From aedc0e81cccfb2edfd6e3a188cc26008f19b6288 Mon Sep 17 00:00:00 2001 From: Paul Hewlett Date: Wed, 20 Nov 2024 17:42:35 +0000 Subject: [PATCH] Fix panic When shutting down a receiver a panic ensues because the waitGroup index becomes less than zero Some miscellaneous spelling errors fixed. When scanning b2c error print string that causes error. Found durng feature development. Fix was tested during feature development. AB#9875 --- azbus/receiver.go | 3 +-- errhandling/errb2c.go | 2 +- restproxyserver/restproxyserver.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/azbus/receiver.go b/azbus/receiver.go index be2d027..57c517c 100644 --- a/azbus/receiver.go +++ b/azbus/receiver.go @@ -163,7 +163,7 @@ func (r *Receiver) String() string { func (r *Receiver) processMessage(ctx context.Context, count int, maxDuration time.Duration, msg *ReceivedMessage, handler Handler) { now := time.Now() - // the context wont have a trace span on it yet, so stick with the reciever logger instance + // the context wont have a trace span on it yet, so stick with the receiver logger instance r.log.Debugf("Processing message %d id %s", count, msg.MessageID) disp, ctx, err := r.handleReceivedMessageWithTracingContext(ctx, msg, handler) @@ -240,7 +240,6 @@ func (r *Receiver) receiveMessages(ctx context.Context) error { select { case <-rctx.Done(): rr.log.Debugf("Stop worker %d", ii) - wg.Done() return case msg := <-msgs: func(rrctx context.Context) { diff --git a/errhandling/errb2c.go b/errhandling/errb2c.go index b8dc905..cc093f1 100644 --- a/errhandling/errb2c.go +++ b/errhandling/errb2c.go @@ -47,7 +47,7 @@ func (e *ErrB2C) WithErrorString(log Logger, errString string) error { if _, scanErr := fmt.Sscanf(errString, b2cFmtString, &e.APIVersion, &e.Status, &e.UserMessage); scanErr != nil { - log.Infof("scan error: %v", scanErr) + log.Infof("scan error %s: %v", errString, scanErr) return scanErr } diff --git a/restproxyserver/restproxyserver.go b/restproxyserver/restproxyserver.go index 673e4ba..67f1593 100644 --- a/restproxyserver/restproxyserver.go +++ b/restproxyserver/restproxyserver.go @@ -74,7 +74,7 @@ func SetQueryParameterParser(p QueryParameterParser) RESTProxyServerOption { } } -// WithIncomingHeaderMatcher adds an intercepror that matches header values. +// WithIncomingHeaderMatcher adds an interceptor that matches header values. func WithIncomingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption { return func(g *RESTProxyServer) { if o != nil && !reflect.ValueOf(o).IsNil() {