NancyFx / Nancy

Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
http://nancyfx.org
MIT License
7.15k stars 1.47k forks source link

Gracefully Restarting A Self-Hosted Nancy Application #2942

Closed nkosi23 closed 5 years ago

nkosi23 commented 5 years ago

I am wondering if there is a way to send a system signal (Unix) to a self-hosted Nancy application and have it terminate the processing of all requests before exiting similar to this Apache's feature.

I am concerned about requests being terminated midway when the application is updated which could leave the database in an inconsistent state. Any hint would be appreciated.

Many thanks

phillip-haydon commented 5 years ago

Do you have your application load balanced??? If so then just remove the machine from the load balancer. Wait for requests to finish. Then deploy. Then add it back in.

nkosi23 commented 5 years ago

No it's not, however you just made me realize that I could pause the front-end reverse proxy to achieve the same result. The update will result in downtime anyway no matter where graceful restart is handled since this is a single node setup. If there is ever a need to make this system HA and therefore load balanced, then what you suggest would cover this scenario too.

Thank you