Skip to content

Commit 5371736

Browse files
committed
check for node connectivity status
1 parent e517a0a commit 5371736

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

logic/zombie.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const (
1414
// ZOMBIE_TIMEOUT - timeout in hours for checking zombie status
1515
ZOMBIE_TIMEOUT = 6
1616
// ZOMBIE_DELETE_TIME - timeout in minutes for zombie node deletion
17-
ZOMBIE_DELETE_TIME = 120
17+
ZOMBIE_DELETE_TIME = 10
1818
)
1919

2020
var (
@@ -139,7 +139,10 @@ func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) {
139139
if servercfg.IsAutoCleanUpEnabled() {
140140
nodes, _ := GetAllNodes()
141141
for _, node := range nodes {
142-
if time.Since(node.LastCheckIn) > time.Minute*ZOMBIE_DELETE_TIME {
142+
if !node.Connected {
143+
continue
144+
}
145+
if time.Since(node.LastCheckIn) > time.Hour*2 {
143146
if err := DeleteNode(&node, true); err != nil {
144147
continue
145148
}
@@ -168,8 +171,8 @@ func checkPendingRemovalNodes(peerUpdate chan *models.Node) {
168171
peerUpdate <- &node
169172
continue
170173
}
171-
if servercfg.IsAutoCleanUpEnabled() {
172-
if time.Since(node.LastCheckIn) > time.Minute*ZOMBIE_DELETE_TIME {
174+
if servercfg.IsAutoCleanUpEnabled() && node.Connected {
175+
if time.Since(node.LastCheckIn) > time.Hour*2 {
173176
if err := DeleteNode(&node, true); err != nil {
174177
continue
175178
}

0 commit comments

Comments
 (0)