Skip to content

Commit 6205177

Browse files
committed
Avoid useless round-trip when using scan(limit=...)
See #73.
1 parent ad2673e commit 6205177

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

happybase/table.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def scan(self, row_start=None, row_stop=None, row_prefix=None,
387387
scan_id, how_many)
388388

389389
if not items:
390-
break # scan has finished
390+
return # scan has finished
391391

392392
n_fetched += len(items)
393393

@@ -401,7 +401,7 @@ def scan(self, row_start=None, row_stop=None, row_prefix=None,
401401
yield item.row, row
402402

403403
if limit is not None and n_returned == limit:
404-
break # not interested in the remainder
404+
return # scan has finished
405405
finally:
406406
self.connection.client.scannerClose(scan_id)
407407
logger.debug(

0 commit comments

Comments
 (0)