Skip to content

Commit

Permalink
fix message id bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yanjiaxin534 committed Jan 23, 2025
1 parent 8533ffe commit 32ebdd8
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ func (rq *RedisQueueProvider) Dequeue(queue string) (interface{}, error) {

// GetRecords retrieves records from the queue starting from the specified index and retrieves the specified size of records.
func (rq *RedisQueueProvider) QueryByPaging(queueName string, start string, size int) ([][]byte, string, error) {
if size <= 0 {
return nil, "", fmt.Errorf("size cannot be 0")
}
if start != "0" {
start = "(" + start
}
Expand All @@ -262,11 +265,10 @@ func (rq *RedisQueueProvider) QueryByPaging(queueName string, start string, size
return nil, "", err
}

lastMessageID := xMessages[len(xMessages)-1].ID
if len(xMessages) <= size {
lastMessageID = ""
} else {
lastMessageID := ""
if len(xMessages) > size {
xMessages = xMessages[:size]
lastMessageID = xMessages[len(xMessages)-2].ID
}
var results [][]byte
for _, xMsg := range xMessages {
Expand Down

0 comments on commit 32ebdd8

Please sign in to comment.