Comments (13)
Yes, it is a problem at the moment. I have “gracefull shutdown” item in my todo list
from actix-web.
Btw thanks for reporting this problems, it is very helpful
from actix-web.
After your last commit, i search now how catch SIGINT, SIGTERM ... i have found Signal handling – Tokio Example but i don'k know how use it whith actix. What solution did you code to catch the signals ?
Thanks.
from actix-web.
You try this actor https://github.com/actix/actix/blob/master/src/actors/signal.rs
from actix-web.
I checked example, it should just work. All you need to do is send StopServer to http server on sigterm.
I will add example
from actix-web.
i wait your example because i don't understand what to do.
I have clone actix, set my Cargo.toml
with actix = { "path" = "../actix", features=["signal"] }
and what to do after ...
how change let addr = HttpServer::new(...).bind(...).spaw()
to include let addr: SyncAddress<_> = Signals.start();
and after (when SIGTERM) call StopServer
?
I you have a full example, i take.
Thanks for your help.
from actix-web.
I added signals support, but I think api could be better
here is example https://github.com/actix/actix-web/tree/master/examples/signals
from actix-web.
Sorry, but I still don't understand how to call the StopServer api after the sigterm signal inside a function which call dev::StopSever + print a graceufll message (by example) + and unconnect db (by example). Is not clear.
from actix-web.
it is not possible to call any arbitrary function on signal at the moment.
if you want to receive signals, you need to implement as Handler
for Signal
message.
but I see your problem, I will think about this problem.
from actix-web.
btw usually you don't need explicit disconnect in rust, usually connections get closed on "drop"
from actix-web.
I understand better https://actix.github.io/actix-web/guide/qs_3_5.html
from actix-web.
I have set .shutdown_timeout(1)
(DEV mode) and i feel like I don't have any more latency time when the application is restarted with cargo watch -x run
.
from actix-web.
only SIGTERM is graceful restart, SIGINT and SIGQUIT are force restart
from actix-web.
Related Issues (20)
- websocket bug!Cannot complete one websocket client to send a message to another client
- Why is the code below why version 4 cannot access httpserver, but version 3 can? HOT 1
- awc CONNECT method support
- add Proxy-Connection header HOT 3
- Filter out completely impossible characters.
- Add macro for route handler accepting all HTTP methods HOT 13
- Compilation fails when using the latest version of rustls HOT 5
- Add pattern syntax for optional trailing slash
- [How to] Middleware `Response body` manipulation.
- Add support to be able to test the route tree using `match_pattern` and `match_name`. HOT 2
- Connecting to the database from an external network causes a spike in connections HOT 1
- actix-http: Compilation fails HOT 1
- Err(NoWebsocketUpgrade) HOT 1
- 在 c++开发中,使用ws进行请求。会因为路径上有中文而报错,In c++ development, using ws for requests will result in an error due to Chinese characters in the path. HOT 1
- 在 c++开发中,使用ws进行请求。会因为路径上有中文而报错,In c++ development, using ws for requests will result in an error due to Chinese characters in the path. HOT 1
- actix-web doesn't compile with rustls 0.23.1 HOT 3
- target mips-unknown-linux-musl compilation failed
- Unexpected routing HOT 1
- Seems like web::Json can't deserilize json with nested keys as payload inside requests into rust structs
- Unable to get app_data information in middleware HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actix-web.