Closed merqurio closed 8 years ago
Using new python async module could be beneficial in a case like slackbot.
The MessageDispatcher.loop could be an @asyncio.coroutine and the main Bot.run simply a loop.run_until_complete.
MessageDispatcher.loop
@asyncio.coroutine
Bot.run
loop.run_until_complete
Understanding that concurrency is about dealing with lots of things at same time and parallelism about doing lots of things at once, I think async coroutines are a good choice in this case.
Pros:
Cons:
I would love to hear your opinions on this.
@merqurio Why did you closed this? I totally agree, but...
To avoid Python 3.4+ only disadvantage, it could be done using Twisted (event-driven).
Sorry, We don't use slack any more. Bests
Using new python async module could be beneficial in a case like slackbot.
The
MessageDispatcher.loop
could be an@asyncio.coroutine
and the mainBot.run
simply aloop.run_until_complete
.Understanding that concurrency is about dealing with lots of things at same time and parallelism about doing lots of things at once, I think async coroutines are a good choice in this case.
Pros:
Cons:
I would love to hear your opinions on this.