@@ -1158,21 +1158,21 @@ func (pc *partitionConsumer) MessageReceived(response *pb.CommandMessage, header
11581158 // error decrypting the payload
11591159 if err != nil {
11601160 // default crypto failure action
1161- crypToFailureAction := crypto .ConsumerCryptoFailureActionFail
1161+ cryptoFailureAction := crypto .ConsumerCryptoFailureActionFail
11621162 if pc .options .decryption != nil {
1163- crypToFailureAction = pc .options .decryption .ConsumerCryptoFailureAction
1163+ cryptoFailureAction = pc .options .decryption .ConsumerCryptoFailureAction
11641164 }
11651165
1166- switch crypToFailureAction {
1166+ switch cryptoFailureAction {
11671167 case crypto .ConsumerCryptoFailureActionFail :
1168- pc .log .Errorf ("consuming message failed due to decryption err : %v" , err )
1168+ pc .log .Errorf ("consuming message failed due to decryption err: %v" , err )
11691169 pc .NackID (newTrackingMessageID (int64 (pbMsgID .GetLedgerId ()), int64 (pbMsgID .GetEntryId ()), 0 , 0 , 0 , nil ))
11701170 return err
11711171 case crypto .ConsumerCryptoFailureActionDiscard :
11721172 pc .discardCorruptedMessage (pbMsgID , pb .CommandAck_DecryptionError )
1173- return fmt .Errorf ("discarding message on decryption error :%v " , err )
1173+ return fmt .Errorf ("discarding message on decryption error: %w " , err )
11741174 case crypto .ConsumerCryptoFailureActionConsume :
1175- pc .log .Warnf ("consuming encrypted message due to error in decryption : %v" , err )
1175+ pc .log .Warnf ("consuming encrypted message due to error in decryption: %v" , err )
11761176 messages := []* message {
11771177 {
11781178 publishTime : timeFromUnixTimestampMillis (msgMeta .GetPublishTime ()),
@@ -1767,16 +1767,16 @@ func (pc *partitionConsumer) runEventsLoop() {
17671767func (pc * partitionConsumer ) internalClose (req * closeRequest ) {
17681768 defer close (req .doneCh )
17691769 state := pc .getConsumerState ()
1770- if state != consumerReady {
1771- // this might be redundant but to ensure nack tracker is closed
1770+ if state == consumerClosed || state == consumerClosing {
1771+ pc . log . WithField ( "state" , state ). Error ( "Consumer is closing or has closed" )
17721772 if pc .nackTracker != nil {
17731773 pc .nackTracker .Close ()
17741774 }
17751775 return
17761776 }
17771777
1778- if state == consumerClosed || state == consumerClosing {
1779- pc . log . WithField ( "state" , state ). Error ( "Consumer is closing or has closed" )
1778+ if state != consumerReady {
1779+ // this might be redundant but to ensure nack tracker is closed
17801780 if pc .nackTracker != nil {
17811781 pc .nackTracker .Close ()
17821782 }
0 commit comments