fix quit issues
This commit is contained in:
@@ -18,15 +18,18 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
closeable = make([]func(), 0)
|
||||||
if err := Container.Provide(func() context.Context {
|
if err := Container.Provide(func() context.Context {
|
||||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
Close()
|
||||||
|
}()
|
||||||
Cancel = cancel
|
Cancel = cancel
|
||||||
return ctx
|
return ctx
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
closeable = make([]func(), 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddCloseAble(c func()) {
|
func AddCloseAble(c func()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user