Skip to content

Commit

Permalink
Change behavior of 'all' flag in bulk insert
Browse files Browse the repository at this point in the history
  • Loading branch information
odedlaz committed Apr 6, 2017
1 parent 7613468 commit 21063c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions twistes/bulk_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,17 @@ def bulk(self, actions, stats_only=False, verbose=False, **kwargs):

inserted = []
errors = []

all = []
for deferred_bulk in self.streaming_bulk(actions, **kwargs):
bulk_results = yield deferred_bulk
for ok, item in bulk_results:
# go through request-response pairs and detect failures
all.append((ok, item))
l = inserted if ok else errors
l.append(item)

if verbose:
returnValue((inserted, errors))
returnValue(all)

if stats_only:
returnValue((len(inserted), len(errors)))
Expand Down

0 comments on commit 21063c5

Please sign in to comment.