最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Can I use asyncio.Event.wait() instead of gRPC await server.wait_for_termination() - Stack Overflow

programmeradmin4浏览0评论

The typical approach for gRPC AsyncIO is

await server.start()
try:
  await server.wait_for_termination()
except:
  ...

But I was wondering rather than dealing with it via a hard stop because wait_for_termination just blocks forever until canceled if I can use asyncio.Event.wait() so I can trigger the termination of the server more cleanly.

Looking at the code for wait_for_termination it goes down to some C bindings so I am not sure if it may be doing anything else special or if asyncio.Event.wait() which I presume would use asyncio loop implementation more effectively (like Windows has it's own loop implementation that's different from UNIX).

As for my integration tests, them seem to pass so I am.

发布评论

评论列表(0)

  1. 暂无评论