mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: graceful shutdown adjustments (#498)
Graceful shutdown should wait for Shutdown call instead of ListenAndServe. This is because ListenAndServe returns immediately upon Shutdown call.
This commit is contained in:
committed by
Reed Allman
parent
ef43e2c772
commit
af8eed098d
@@ -41,7 +41,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func contextWithSignal(ctx context.Context, signals ...os.Signal) context.Context {
|
||||
func contextWithSignal(ctx context.Context, signals ...os.Signal) (context.Context, context.CancelFunc) {
|
||||
newCTX, halt := context.WithCancel(ctx)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, signals...)
|
||||
@@ -59,5 +59,5 @@ func contextWithSignal(ctx context.Context, signals ...os.Signal) context.Contex
|
||||
}
|
||||
}
|
||||
}()
|
||||
return newCTX
|
||||
return newCTX, halt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user