Skip to content

Commit 0126ac9

Browse files
Update server.py
1 parent b1c551f commit 0126ac9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

frameworks/Python/aiohttp/app/server.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import multiprocessing
12
import os
3+
import platform
24
import socket
3-
import multiprocessing
5+
46
from aiohttp import web
7+
58
from .main import create_app
6-
import uvloop
79

810
SERVERS_COUNT = multiprocessing.cpu_count()
911
BACKLOG = 2048
@@ -12,7 +14,9 @@
1214
def start_server(sock, cpu_id):
1315
if hasattr(os, "sched_setaffinity"):
1416
os.sched_setaffinity(0, {cpu_id})
15-
uvloop.install()
17+
if platform.python_implementation() != "PyPy":
18+
import uvloop
19+
uvloop.install()
1620
app = create_app()
1721

1822
web.run_app(app, sock=sock, backlog=BACKLOG, access_log=None)
@@ -43,4 +47,4 @@ def create_reusable_socket(host='0.0.0.0', port=8080):
4347
workers.append(worker)
4448

4549
for worker in workers:
46-
worker.join()
50+
worker.join()

0 commit comments

Comments
 (0)