Skip to content

Commit

Permalink
Merge branch 'master' of gitlab.infihis.cn:zh217/aiochan
Browse files Browse the repository at this point in the history
  • Loading branch information
zh217 committed Aug 17, 2018
2 parents 0dce5f9 + 97f6618 commit e591023
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aiochan/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ async def worker():

return q

def to_iterable(self, buffer_size=None):
def to_iterable(self, buffer_size=1):
"""
Return an iterable containing the values in the channel.
Expand Down
20 changes: 20 additions & 0 deletions aiochan/test/ttt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import asyncio
import aiochan as ac

if __name__ == '__main__':
async def worker(inp, tag):
async for v in inp:
print('%s received %s' % (tag, v))


async def main():
dup = ac.from_range(5).dup()
inputs = [ac.Chan(name='inp%s' % i) for i in range(3)]
dup.tap(*inputs)

for idx, c in enumerate(inputs):
ac.go(worker(c, 'worker%s' % idx))
await asyncio.sleep(1)


ac.run(main())

0 comments on commit e591023

Please sign in to comment.