Copilot commented on code in PR #1364:
URL: https://github.com/apache/pulsar-client-go/pull/1364#discussion_r2084487685


##########
pulsar/consumer_partition.go:
##########
@@ -1977,7 +1984,11 @@ func (pc *partitionConsumer) grabConn(assignedBrokerURL 
string) error {
                KeySharedMeta:              keySharedMeta,
        }
 
-       pc.startMessageID.set(pc.clearReceiverQueue())
+       if seekMsgID := pc.seekMessageID.get(); seekMsgID != nil {
+               pc.startMessageID.set(seekMsgID)

Review Comment:
   [nitpick] After using seekMessageID to update startMessageID, consider 
resetting seekMessageID to nil to avoid the state persisting across subsequent 
reconnects.
   ```suggestion
                pc.startMessageID.set(seekMsgID)
                pc.seekMessageID.set(nil) // Reset seekMessageID to nil to 
avoid persisting state across reconnects
   ```



##########
pulsar/reader_test.go:
##########
@@ -1237,3 +1239,60 @@ func TestReaderWithSeekByTime(t *testing.T) {
                })
        }
 }
+
+func TestReaderReadFromLatest(t *testing.T) {
+       topic := newTopicName()
+       client, err := NewClient(ClientOptions{
+               URL: lookupURL,
+       })
+
+       assert.Nil(t, err)

Review Comment:
   [nitpick] Consider using require.NoError(t, err) instead of assert.Nil(t, 
err) for client creation to ensure immediate test termination on error and 
maintain consistency within the test.
   ```suggestion
        require.NoError(t, err)
   ```



-- 
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