Merge remote-tracking branch 'origin/asynciofix' into development
This commit is contained in:
commit
523a2b094c
@ -11,6 +11,7 @@ import logging
|
||||
import random
|
||||
import traceback
|
||||
import os
|
||||
import sys
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
@ -27,6 +28,12 @@ logging.basicConfig(level='INFO')
|
||||
# If uvloop is installed, change to that eventloop policy as it
|
||||
# is more efficient
|
||||
try:
|
||||
# https://stackoverflow.com/a/45700730
|
||||
if sys.platform == 'win32':
|
||||
loop = asyncio.ProactorEventLoop()
|
||||
asyncio.set_event_loop(loop)
|
||||
logging.warning('Detected Windows. Changing event loop to ProactorEventLoop.')
|
||||
else:
|
||||
import uvloop
|
||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||
del uvloop
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user