Commit b9d319f8 authored by Vladimir Barsukov's avatar Vladimir Barsukov
Browse files

fix

parent 14e3a3b8
...@@ -47,7 +47,9 @@ func (q *ZQuit) Val() int { ...@@ -47,7 +47,9 @@ func (q *ZQuit) Val() int {
} }
func (q *ZQuit) WaitInterruptPrePost(pre func(), post func()) { func (q *ZQuit) WaitInterruptPrePost(pre func(), post func()) {
pre() if pre != nil {
pre()
}
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM) signal.Notify(c, os.Interrupt, syscall.SIGTERM)
...@@ -56,11 +58,13 @@ func (q *ZQuit) WaitInterruptPrePost(pre func(), post func()) { ...@@ -56,11 +58,13 @@ func (q *ZQuit) WaitInterruptPrePost(pre func(), post func()) {
q.Wait() q.Wait()
post() if post != nil {
post()
}
} }
func (q *ZQuit) WaitInterrupt() { func (q *ZQuit) WaitInterrupt() {
q.WaitInterruptPrePost(func() {}, func() {}) q.WaitInterruptPrePost(nil, nil)
} }
func (q *ZQuit) Middleware(c *gin.Context) { func (q *ZQuit) Middleware(c *gin.Context) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment