Skip to content

Commit 6c1206d

Browse files
committed
Integrate uvloop and winloop support
1 parent 5c17f4d commit 6c1206d

File tree

3 files changed

+91
-11
lines changed

3 files changed

+91
-11
lines changed

bot/launcher.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,10 @@
1010

1111
from rodhaj import Rodhaj
1212

13-
# Only used for Windows development
14-
# if os.name == "nt":
15-
# asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
16-
# else:
17-
# try:
18-
# import uvloop
19-
20-
# asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
21-
# except ImportError:
22-
# pass
13+
if os.name == "nt":
14+
from winloop import install
15+
else:
16+
from uvloop import install
2317

2418
load_dotenv()
2519

@@ -45,6 +39,7 @@ async def main() -> None:
4539

4640
def launch() -> None:
4741
with RodhajLogger():
42+
install()
4843
asyncio.run(main())
4944

5045

poetry.lock

+85-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ python = ">=3.9,<3.12"
1111
discord-py = {extras = ["speed"], version = "^2.3.2"}
1212
python-dotenv = "^1.0.0"
1313
uvloop = {markers = "sys_platform != \"win32\"", version = "^0.19.0"}
14+
winloop = {markers = "sys_platform == \"win32\"", version = "^0.0.9"}
1415
asyncpg = "^0.28.0"
1516
discord-ext-menus = {git = "https://github.com/Rapptz/discord-ext-menus", rev = "8686b5d1bbc1d3c862292eb436ab630d6e9c9b53"}
1617
psutil = "^5.9.6"

0 commit comments

Comments
 (0)