Skip to content

Commit fc37c8d

Browse files
committed
fix: preserve search count parameter during queue state restore
When restoring the queue state from disk, the count parameter for search requests was being lost due to JSON marshaling converting integers to float64. This fix ensures proper type conversion when restoring the state, preventing the count from defaulting to 10. - Add type conversion for count parameter in LoadState - Handle float64 to int conversion for SearchRequest items - Preserve original count value in restored queue state
1 parent 168ac46 commit fc37c8d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/x/queue_state.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ func (rq *RequestQueue) LoadState() error {
143143
continue
144144
}
145145

146+
if reqType == SearchRequest {
147+
if count, exists := item.Data["count"].(float64); exists {
148+
149+
item.Data["count"] = int(count)
150+
}
151+
}
152+
146153
responseChan := make(chan interface{}, 1)
147154
heap.Push(queue, &PriorityItem{
148155
data: RequestData{

0 commit comments

Comments
 (0)