fix: mismatch WaitGroup
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gitea.suyono.dev/suyono/wingmate"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -15,6 +16,11 @@ const (
|
||||
)
|
||||
|
||||
func (i *Init) signalPump(wg *sync.WaitGroup, selfExit <-chan any) {
|
||||
defer wg.Done()
|
||||
defer func() {
|
||||
wingmate.Log().Info().Msg("signal pump completed")
|
||||
}()
|
||||
|
||||
if seStatus := i.sigTermPump(time.Now(), selfExit); seStatus == triggered {
|
||||
return
|
||||
}
|
||||
@@ -26,6 +32,11 @@ func (i *Init) sigKillPump(startTime time.Time, selfExit <-chan any) {
|
||||
t := time.NewTicker(time.Millisecond * 200)
|
||||
defer t.Stop()
|
||||
|
||||
wingmate.Log().Info().Msg("start pumping SIGKILL signal")
|
||||
defer func() {
|
||||
wingmate.Log().Info().Msg("stop pumping SIGKILL signal")
|
||||
}()
|
||||
|
||||
for time.Since(startTime) < time.Second {
|
||||
_ = unix.Kill(-1, unix.SIGKILL)
|
||||
|
||||
@@ -41,6 +52,11 @@ func (i *Init) sigTermPump(startTime time.Time, selfExit <-chan any) status {
|
||||
t := time.NewTicker(time.Millisecond * 100)
|
||||
defer t.Stop()
|
||||
|
||||
wingmate.Log().Info().Msg("start pumping SIGTERM signal")
|
||||
defer func() {
|
||||
wingmate.Log().Info().Msg("stop pumping SIGTERM signal")
|
||||
}()
|
||||
|
||||
for time.Since(startTime) < time.Duration(time.Second*4) {
|
||||
_ = unix.Kill(-1, unix.SIGTERM)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user