现在可以正常工作了
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
import signal
|
||||
from threading import Event
|
||||
|
||||
from .main import logger, run_engine
|
||||
|
||||
|
||||
async def _async_main():
|
||||
stop_event = Event()
|
||||
loop = asyncio.get_running_loop()
|
||||
for sig in (signal.SIGINT, signal.SIGTERM):
|
||||
try:
|
||||
loop.add_signal_handler(sig, stop_event.set)
|
||||
except NotImplementedError:
|
||||
# 信号处理在某些平台(如 Windows)不可用,忽略即可
|
||||
pass
|
||||
await run_engine(stop_event)
|
||||
|
||||
|
||||
def main():
|
||||
logger.info("worker 进程启动")
|
||||
asyncio.run(_async_main())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user