muruga21 / LoadDistrix

🌐 A lightweight, efficient HTTP load balancer developed in Go
7 stars 7 forks source link

Graceful Shutdown for HTTP Server #8

Closed vidhvath28 closed 1 week ago

vidhvath28 commented 1 week ago

The current load balancer implementation lacks a graceful shutdown mechanism. This means that when the server receives termination signals (e.g., SIGINT or SIGTERM), it immediately stops processing new and ongoing requests, potentially leading to incomplete requests and loss of data. Implementing a graceful shutdown allows the server to stop accepting new requests, while still completing ongoing requests before shutting down. This ensures a smooth shutdown process and improves reliability during server restarts or deployments.

github-actions[bot] commented 1 week ago

👋 Thank you for raising an issue! We appreciate your effort in helping us improve. Our team will review it shortly. Stay tuned!

vidhvath28 commented 1 week ago

I would like to work on this issue , kindly assign this issue to me .

vidhvath28 commented 1 week ago

@muruga21 My approach for this issue :-

  1. Add a channel to listen for termination signals.
  2. Implement the graceful shutdown logic by calling server.Shutdown() in response to termination signals.
  3. Ensure that the shutdown process waits for all in-flight requests to complete.
toastsandwich commented 1 week ago

Nice find @vidhvath28, cant believe i missed it !!

vidhvath28 commented 1 week ago

I have resolved the error and submitted a PR #9 , kindly please check it and consider this PR for Hacktoberfest and GSsoC by tagging it with hacktoberfest-accepted and gssoc-ext.

toastsandwich commented 1 week ago

I am a contributor for this repo too, @muruga21 please look into this.

vidhvath28 commented 1 week ago

@toastsandwich just few minutes back I have fixed the issue and submitted an PR for it

vidhvath28 commented 1 week ago

@toastsandwich can you please consider this PR for Hacktoberfest and GSsoC by tagging it with hacktoberfest-accepted and gssoc-ext.

toastsandwich commented 1 week ago

@vidhvath28 i am just contributor here, i am not project admin and for hacktober there must be tag added in repository as hacktober

muruga21 commented 1 week ago

@vidhvath28 Great work man..!