Skip to content

Commit 4ea3a0f

Browse files
author
Pedro J. Martínez
committed
fix: pagination returns empty items occasionally
fixed bug that affected FetchVods: when a streamer deleted a stream it would fetch multiple iterations as it would never find the last vod, if the next iteration was items length = 0 it would exit with ErrEmpty instead of returning the already collected items
1 parent d8f624d commit 4ea3a0f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rcaptv/helix/helix.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ PaginationLoop:
252252

253253
items := parsed.Data
254254
if len(items) == 0 {
255+
if len(all) != 0 {
256+
// no more items but we have data from previous iterations, proceed
257+
break PaginationLoop
258+
}
255259
return nil, ErrItemsEmpty
256260
}
257261
for _, item := range parsed.Data {

0 commit comments

Comments
 (0)