Skip to content

Commit

Permalink
Fix panic
Browse files Browse the repository at this point in the history
When shutting down a receiver a panic ensues because the waitGroup
index becomes less than zero

Some miscellaneous spelling errors fixed.

Found during development of anothet feature. Fix was tested during
feature development.

AB#9875
  • Loading branch information
eccles committed Nov 21, 2024
1 parent 4f7d8a4 commit 38e0cf6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions azbus/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions errhandling/errb2c.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.Debugf("scan error: %v", scanErr)
return scanErr
}

Expand All @@ -72,15 +72,15 @@ func GetErrB2c(ctx context.Context, err error) (*ErrB2C, error) {

// chance it is a status.Error (can't access status.Error as its part of an internal package)
if !strings.HasPrefix(err.Error(), grpcErrPrefix) {
log.Infof("error is not b2c error: %v", err)
log.Debugf("error is not b2c error: %v", err)
return nil, err
}

// can't use errors.Unwrap because status.Error doesn't implement Unwrap method
b2cErrString := strings.TrimPrefix(err.Error(), grpcErrPrefix)

if convErr := errB2C.WithErrorString(log, b2cErrString); convErr != nil {
log.Infof("unable to add error string: %v", convErr)
log.Debugf("unable to add error string: %v", convErr)
return nil, convErr
}

Expand Down
2 changes: 1 addition & 1 deletion restproxyserver/restproxyserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 38e0cf6

Please sign in to comment.