Skip to content

Commit 7cb90c9

Browse files
committed
Stop if no records are returned by API call, per Daniel's recommendation.
1 parent f5e9617 commit 7cb90c9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sunlight/pagination.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def pagingfunc(*args, **kwargs):
5858
kwargs[self.page_attr] = page
5959
resp = attr(*args, **kwargs)
6060

61+
if not resp:
62+
logger.debug('! %s returned 0 results this iteration, stopping' % name)
63+
stopthepresses = True
64+
6165
for rec in resp:
6266

6367
yield rec

0 commit comments

Comments
 (0)