go-zero
go-zero copied to clipboard
Graceful shutdown
grpc 程序,接收到了kill信号,直接退出程序,并没等正在处理程序的协程处理结束后再退出
Show the main function, and how to you kill the app?
请问您的问题找到了吗? 我自己测试http服务,ctrl_c取消程序,也是直接退出,并没等正在处理程序的协程处理结束后再退出; 我看文档说,go zero的server.Start()方法会自动处理优雅重启的啊,没找到问题
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Did you find your question? I tested the http service myself, ctrl_c canceled the program, and also exited directly, and did not wait for the coroutine processing of the processing program to end before exiting; I read the documentation and said that the server.Start() method of go zero will automatically handle graceful restarts, but I didn't find any problems.
ctrl-c is not going to happy in service. Use kill
to trigger graceful shutdown.
i try to use kill pid to shutdown the prigram,but it also can not grace shut down,it still shutdow right now
This issue is stale because it has been open for 30 days with no activity.
请问您的问题找到了吗? 我自己测试http服务,ctrl_c取消程序,也是直接退出,并没等正在处理程序的协程处理结束后再退出; 我看文档说,go zero的server.Start()方法会自动处理优雅重启的啊,没找到问题
测试最新版,仍然有这个问题。
s := rest.MustNewServer(*cfg)
s.Stop() // 执行后在进行中的请求全部立即返回了。
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Did you find your problem? I tested the http service by myself, ctrl_c canceled the program, and exited directly, and did not wait for the coroutine processing of the program to finish before exiting; I read the document that go zero's server.Start( ) method will automatically handle graceful restart, no problem found
Tried the latest version and still have this problem.
s := rest.MustNewServer(*cfg)
s.Stop() // All requests in progress are returned immediately after execution.
go-zero only handles SIGTERM, because in server, you never hit ctrl-c to running services.