mirror of
https://github.com/comma-hacks/webrtc.git
synced 2025-10-10 02:20:10 +08:00
enable uvloop
This commit is contained in:
31
server.py
31
server.py
@@ -18,29 +18,10 @@ from aiortc.contrib.media import MediaBlackhole
|
|||||||
import requests
|
import requests
|
||||||
import numpy
|
import numpy
|
||||||
# optional, for better performance
|
# optional, for better performance
|
||||||
# try:
|
try:
|
||||||
# import uvloop
|
import uvloop
|
||||||
# except ImportError:
|
except ImportError:
|
||||||
# uvloop = None
|
uvloop = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import tracemalloc
|
|
||||||
|
|
||||||
tracemalloc.start(10)
|
|
||||||
|
|
||||||
|
|
||||||
async def heap_snapshot():
|
|
||||||
while True:
|
|
||||||
snapshot = tracemalloc.take_snapshot()
|
|
||||||
top_stats = snapshot.statistics('lineno')
|
|
||||||
|
|
||||||
print("[ Top 10 ]")
|
|
||||||
for stat in top_stats[:10]:
|
|
||||||
print(stat)
|
|
||||||
await asyncio.sleep(10)
|
|
||||||
|
|
||||||
|
|
||||||
def webjoystick(x, y):
|
def webjoystick(x, y):
|
||||||
@@ -207,8 +188,8 @@ if __name__ == "__main__":
|
|||||||
if args.verbose:
|
if args.verbose:
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
# if uvloop is not None:
|
if uvloop is not None:
|
||||||
# asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
|
||||||
signaling = SecureputSignaling(args.signaling_server)
|
signaling = SecureputSignaling(args.signaling_server)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user