This commit is contained in:
yumoqing 2026-04-09 23:05:08 +08:00
parent 04c6195720
commit 2b48dbe094
3 changed files with 12 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import sys
import codecs import codecs
from urllib.parse import quote from urllib.parse import quote
import json import json
import uvloop
import asyncio import asyncio
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
@ -260,9 +261,16 @@ async def sqlorContext(module):
def background_reco(reco, *args, **kw): def background_reco(reco, *args, **kw):
asyncio.create_task(reco(*args, **kw)) asyncio.create_task(reco(*args, **kw))
def get_loop_type():
loop = asyncio.get_event_loop()
if isinstance(loop, uvloop.Loop):
return 'uvloop.Loop'
return str(type(loop))
def initEnv(): def initEnv():
g = ServerEnv() g = ServerEnv()
set_builtins() set_builtins()
g.get_loop_type = get_loop_type()
rf = RegisterFunction() rf = RegisterFunction()
rf.register('i18n', i18n) rf.register('i18n', i18n)
g.paramify = paramify g.paramify = paramify

View File

@ -1,3 +1,5 @@
import uvloop
uvloop.install()
import os, sys import os, sys
import argparse import argparse
from appPublic.log import MyLogger, info, debug, warning from appPublic.log import MyLogger, info, debug, warning

View File

@ -11,6 +11,8 @@ license = MIT
packages = find: packages = find:
python_requires = >=3.8 python_requires = >=3.8
install_requires = install_requires =
uvloop
httptools
redis redis
asyncio asyncio
aiofiles aiofiles