nodece commented on code in PR #1256:
URL: https://github.com/apache/pulsar-client-go/pull/1256#discussion_r1843130099


##########
pulsar/consumer_partition.go:
##########
@@ -622,23 +622,23 @@ func (pc *partitionConsumer) getLastMessageID() 
(*trackingMessageID, error) {
                <-req.doneCh
                return req.msgID, req.err
        }
-       for {
-               msgID, err := request()
-               if err == nil {
-                       return msgID, nil
-               }
-               if remainTime <= 0 {
-                       pc.log.WithError(err).Error("Failed to 
getLastMessageID")
-                       return nil, fmt.Errorf("failed to getLastMessageID due 
to %w", err)
-               }
+
+       opFn := func() (*trackingMessageID, error) {
+               return request()
+       }
+       ctx, cancel := context.WithTimeout(context.Background(), 
pc.client.operationTimeout)
+       defer cancel()
+       res, err := internal.Retry(ctx, opFn, func(err error) time.Duration {

Review Comment:
   Good catch!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to