Skip to content

Commit

Permalink
Bug fix. We cannot predict the order of execution in gather.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanslenders committed Feb 14, 2014
1 parent 0449ee4 commit ab03a5a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion asyncio_redis/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ def auto_decode(f):
raise AssertionError('Invalid type: %r' % type(result))

for f in self.iter_raw():
yield auto_decode(f)
# We should immediately wrap this coroutine in async(), to be sure
# that the order of the queue remains, even if we wrap it in
# gather:
# f1 = next(multibulk)
# f2 = next(multibulk)
# r1, r2 = gather(f1, f2)
yield asyncio.async(auto_decode(f))

def __repr__(self):
return 'MultiBulkReply(protocol=%r, count=%r)' % (self.protocol, self.count)
Expand Down

3 comments on commit ab03a5a

@tumb1er
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, now it works correctly.

@jonathanslenders
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reporting the bug.

@tumb1er
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing it quickly :)

Please sign in to comment.