cmd/routed: signal shutdown better
This commit is contained in:
parent
0862521d93
commit
cce1197484
|
@ -68,7 +68,7 @@ func main() {
|
||||||
|
|
||||||
signal.Notify(ch, os.Interrupt)
|
signal.Notify(ch, os.Interrupt)
|
||||||
|
|
||||||
time.Sleep(30 * time.Second)
|
<-ctx.Done()
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,7 @@ func setupHTTP(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
ln.Log(ctx, ln.F{"kind": "http"}, ln.Action("shutdown signal recieved"))
|
||||||
hs.SetKeepAlivesEnabled(false)
|
hs.SetKeepAlivesEnabled(false)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
@ -125,6 +126,7 @@ func setupQuic(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
ln.Log(ctx, ln.F{"kind": "quic"}, ln.Action("shutdown signal recieved"))
|
||||||
qs.SetKeepAlivesEnabled(false)
|
qs.SetKeepAlivesEnabled(false)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
@ -155,6 +157,7 @@ func setupTLS(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
ln.Log(ctx, ln.F{"kind": "https"}, ln.Action("shutdown signal recieved"))
|
||||||
hs.SetKeepAlivesEnabled(false)
|
hs.SetKeepAlivesEnabled(false)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
|
Loading…
Reference in New Issue