fix auto-flush behavior

This commit is contained in:
James Turk 2012-04-13 23:44:36 -04:00
parent 95a92d124c
commit 574d1da843

View File

@ -37,9 +37,9 @@ class CloudSearch(object):
newjson = json.dumps(newdoc) newjson = json.dumps(newdoc)
newsize = len(newjson) newsize = len(newjson)
if ((self._current_size + newsize > self.MAX_BYTES) or if (self._current_size + newsize > self.MAX_BYTES or
(self._flush_every and len(self._current_batch > self._flush_every) (self._flush_every and
)): len(self._current_batch) > self._flush_every)):
self.flush() self.flush()
self._current_batch.append(json.dumps(newdoc)) self._current_batch.append(json.dumps(newdoc))