summaryrefslogtreecommitdiff
path: root/happybase/table.py
diff options
context:
space:
mode:
authorWouter Bolsterlee <uws@xs4all.nl>2014-11-24 23:16:46 +0100
committerWouter Bolsterlee <uws@xs4all.nl>2014-11-24 23:16:46 +0100
commit8a27521bf9a80411f46a600751329e92e43fccf9 (patch)
treebca91ba440b41dd18bac57ca47401bc5ffee1942 /happybase/table.py
parent15b5311f0011a3c29d606a2b5fbedbcd828dbef0 (diff)
downloadhappybase-8a27521bf9a80411f46a600751329e92e43fccf9.tar.gz
Correctly handle scanner that are smaller than expected
Fixes #72.
Diffstat (limited to 'happybase/table.py')
-rw-r--r--happybase/table.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/happybase/table.py b/happybase/table.py
index 60e74be..ac897d2 100644
--- a/happybase/table.py
+++ b/happybase/table.py
@@ -389,6 +389,9 @@ class Table(object):
items = self.connection.client.scannerGetList(
scan_id, how_many)
+ if not items:
+ break # scan has finished
+
n_fetched += len(items)
for n_returned, item in enumerate(items, n_returned + 1):
@@ -401,11 +404,7 @@ class Table(object):
yield item.row, row
if limit is not None and n_returned == limit:
- return
-
- # Avoid round-trip when exhausted
- if len(items) < how_many:
- break
+ break # not interested in the remainder
finally:
self.connection.client.scannerClose(scan_id)
logger.debug(