Skip to content

Commit 2f0b190

Browse files
authored
Merge pull request #50 from supermeng/master
Added notify for stop engine
2 parents 012a90e + b17e925 commit 2f0b190

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

engine/engine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ func (engine *OrcEngine) onClusterNodeLost(nodeName string, downCount int) {
697697
log.Warnf("Cluster node is down, [%q], %d nodes down in all, will check if need stop the engine", nodeName, downCount)
698698
if downCount >= maxDownNode {
699699
log.Warnf("Too many cluster nodes stoped in a short period, need stop the engine")
700+
ntfController.Send(NewNotifySpec("Cluster", "Deployd",
701+
1, time.Now(), NotifyClusterAbnormal))
700702
engine.Stop()
701703
}
702704
}

engine/notify.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var (
2424
NotifyPodUnHealthy = "LAIN found pod Unhealthy, please check your service"
2525

2626
NotifyClusterUnHealthy = "LAIN found Cluster Manager Unhealthy, please check your cluster"
27+
NotifyClusterAbnormal = "LAIN found too many cluster nodes stoped in a short period, need stop the engine, please check your cluster"
2728

2829
NotifyUpgradeFailedTmplt = "LAIN found Last version:%d upgrade is terrrible, please check your code carefully!!"
2930
)

utils/elector/elect.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func (e *Elector) watch(leaderCh chan string, stop chan struct{}) {
8484
}
8585
retry = 0
8686

87+
// libkv locker refresh ttl every ttl / 3, so will receive data each refresh time.
8788
for kv := range ch {
8889
value := string(kv.Value)
8990
log.Debugf("Get watch event, leader value changed to %s", value)

0 commit comments

Comments
 (0)