admin 管理员组文章数量: 1086019
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.
本文标签: pythonCan I use asyncioEventwait() instead of gRPC await serverwaitfortermination()Stack Overflow
版权声明:本文标题:python - Can I use asyncio.Event.wait() instead of gRPC await server.wait_for_termination() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744006366a2517361.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论