Skip to content

Commit 1fd6fb4

Browse files
committed
Break out of save loops if there are no more results
1 parent cbb086c commit 1fd6fb4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

controllers/bluesky/indexer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ export class BlueskyIndexer {
8686
});
8787
}
8888

89-
if (!nextCursor) {
89+
// Break if no more results OR no cursor (API returns empty feed with cursor when done)
90+
if (feed.length === 0 || !nextCursor) {
9091
break;
9192
}
9293

@@ -154,7 +155,8 @@ export class BlueskyIndexer {
154155
});
155156
}
156157

157-
if (!nextCursor) {
158+
// Break if no more results OR no cursor (API returns empty feed with cursor when done)
159+
if (feed.length === 0 || !nextCursor) {
158160
break;
159161
}
160162

@@ -220,7 +222,8 @@ export class BlueskyIndexer {
220222
});
221223
}
222224

223-
if (!nextCursor) {
225+
// Break if no more results OR no cursor (API returns empty feed with cursor when done)
226+
if (feed.length === 0 || !nextCursor) {
224227
break;
225228
}
226229

0 commit comments

Comments
 (0)