Przeglądaj źródła

[aggregator] ignore the hosts maintained (#609)

游正川 6 lat temu
rodzic
commit
9ef418d90b
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      modules/aggregator/sdk/sdk.go

+ 4 - 0
modules/aggregator/sdk/sdk.go

@@ -47,7 +47,11 @@ func HostnamesByID(group_id int64) ([]string, error) {
 	}
 
 	hosts := []string{}
+	nowTs := time.Now().Unix()
 	for _, x := range resp.Hosts {
+		if x.MaintainBegin <= nowTs && nowTs <= x.MaintainEnd {
+			continue
+		}
 		hosts = append(hosts, x.Hostname)
 	}
 	return hosts, nil