mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
refactor: Update SendNotification function to handle old and new settings triggers
This commit is contained in:
@@ -101,8 +101,14 @@ func (svc *MasterServiceV2) Stop() {
|
||||
|
||||
func (svc *MasterServiceV2) Monitor() {
|
||||
log.Infof("master[%s] monitoring started", svc.GetConfigService().GetNodeKey())
|
||||
|
||||
// ticker
|
||||
ticker := time.NewTicker(svc.monitorInterval)
|
||||
|
||||
for {
|
||||
if err := svc.monitor(); err != nil {
|
||||
// monitor
|
||||
err := svc.monitor()
|
||||
if err != nil {
|
||||
trace.PrintError(err)
|
||||
if svc.stopOnError {
|
||||
log.Errorf("master[%s] monitor error, now stopping...", svc.GetConfigService().GetNodeKey())
|
||||
@@ -111,7 +117,8 @@ func (svc *MasterServiceV2) Monitor() {
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(svc.monitorInterval)
|
||||
// wait
|
||||
<-ticker.C
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user