gregzaal / Auto-Voice-Channels

A Discord bot that automatically creates voice channels as they are needed.
MIT License
190 stars 101 forks source link

Switch executors #74

Closed ChillFish8 closed 3 years ago

ChillFish8 commented 4 years ago

moving from standard handling to asyncio's run_in_executor because it's just easier

gregzaal commented 3 years ago

Man, reading your diffs is really hard, 90% of it is just unnecessary formatting changes, I'm guessing by some tool. It's a pain to try and understand what's actually changed. Please don't do this.

Haven't tested but seems reasonable. What's with all the await asyncio.sleep(0)'s everywhere?

ChillFish8 commented 3 years ago

Its Pycharm's BS default config i keep forgetting to change

asyncio.sleep(0) forces the coroutine to hand control back to the event loop without adding a delay, it should help the delay issues a bit with it not blocking.

This is due after benching the loops and the for loops has enough of a impact to start blocking the loop.

ChillFish8 commented 3 years ago

Example of what asyncio.sleep(0) does:

# This would normally block everything
while True:
     pass

# This would will not block
while True:
     await asyncio.sleep(0)