mirror of
https://github.com/kontera-technologies/go-supervisor
synced 2025-10-05 14:46:50 +08:00
fix close monitor heartbeat (#5)
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
@@ -307,7 +307,6 @@ func readerToChan(producer ProduceFn, out chan<- *interface{}, closeWhenDone, st
|
|||||||
//
|
//
|
||||||
// When stopC closes, this function will exit immediately.
|
// When stopC closes, this function will exit immediately.
|
||||||
func monitorHeartBeat(idleTimeout time.Duration, heartbeat, isMonitorClosed, stopC chan bool, stop func() error, notifyEvent func(string, ...interface{})) {
|
func monitorHeartBeat(idleTimeout time.Duration, heartbeat, isMonitorClosed, stopC chan bool, stop func() error, notifyEvent func(string, ...interface{})) {
|
||||||
defer close(isMonitorClosed)
|
|
||||||
t := time.NewTimer(idleTimeout)
|
t := time.NewTimer(idleTimeout)
|
||||||
defer t.Stop()
|
defer t.Stop()
|
||||||
|
|
||||||
@@ -333,6 +332,7 @@ func monitorHeartBeat(idleTimeout time.Duration, heartbeat, isMonitorClosed, sto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(isMonitorClosed)
|
||||||
if err := stop(); err != nil {
|
if err := stop(); err != nil {
|
||||||
notifyEvent("StopError", err.Error())
|
notifyEvent("StopError", err.Error())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user