func (d *dispatcher) expireNodes() {
	cutoffTimestamp := timestampNow() - d.nodeExpirationSeconds

	d.store.Lock()
	defer d.store.Unlock()

	initialNodeCount := len(d.store.nodes)

	for name, node := range d.store.nodes {
		node.RLock()
		if node.heartbeat < cutoffTimestamp {
			if name != "" {
				// Don't report on the dummy "" host for unscheduled configs
				log.Infof("Expiring out node %s, last status report %d seconds ago", name, timestampNow()-node.heartbeat)
			}
			for digest, config := range node.digestToConfig {
				delete(d.store.digestToNode, digest)
				log.Debugf("Adding %s:%s as a dangling Cluster Check config", config.Name, digest)
				d.store.danglingConfigs[digest] = config
				danglingConfigs.Inc(le.JoinLeaderValue)
			}
			delete(d.store.nodes, name)

			// Remove metrics linked to this node
			nodeAgents.Dec(le.JoinLeaderValue)
			dispatchedConfigs.Delete(name, le.JoinLeaderValue)
			statsCollectionFails.Delete(name, le.JoinLeaderValue)
			busyness.Delete(name, le.JoinLeaderValue)
		}
		node.RUnlock()
	}

	if initialNodeCount != 0 && len(d.store.nodes) == 0 {
		log.Warn("No nodes reporting, cluster checks will not run")
	}
}
// expireNodes iterates over nodes and removes the ones that have not
// reported for more than the expiration duration. The configurations
// dispatched to these nodes will be moved to the danglingConfigs map.
expireNodes iterates over nodes and removes the ones that have not
reported for more than the expiration duration. The configurations
dispatched to these nodes will be moved to the danglingConfigs map.
// expireNodes iterates over nodes and removes the ones that have not // reported for more than the expiration duration . The configurations // dispatched to these nodes will be moved to the danglingConfigs map .
func (d *dispatcher) expireNodes() {
	cutoffTimestamp := timestampNow() - d.nodeExpirationSeconds
	d.store.Lock()
	defer d.store.Unlock()
	initialNodeCount := len(d.store.nodes)
	for name, node := range d.store.nodes {
		node.RLock()
		if node.heartbeat < cutoffTimestamp {
			if name != "" {
				log.Infof("Expiring out node %s, last status report %d seconds ago", name, timestampNow()-node.heartbeat)
			}
			for digest, config := range node.digestToConfig {
				delete(d.store.digestToNode, digest)
				log.Debugf("Adding %s:%s as a dangling Cluster Check config", config.Name, digest)
				d.store.danglingConfigs[digest] = config
				danglingConfigs.Inc(le.JoinLeaderValue)
			}
			delete(d.store.nodes, name)
			nodeAgents.Dec(le.JoinLeaderValue)
			dispatchedConfigs.Delete(name, le.JoinLeaderValue)
			statsCollectionFails.Delete(name, le.JoinLeaderValue)
			busyness.Delete(name, le.JoinLeaderValue)
		}
		node.RUnlock()
	}
	if initialNodeCount != 0 && len(d.store.nodes) == 0 {
		log.Warn("No nodes reporting, cluster checks will not run")
	}
}
func ( d * dispatcher ) expireNodes ( ) { cutoffTimestamp := timestampNow ( ) - d . nodeExpirationSeconds d . store . Lock ( ) defer d . store . Unlock ( ) initialNodeCount := len ( d . store . nodes ) for name , node := range d . store . nodes { node . RLock ( ) if node . heartbeat < cutoffTimestamp { if name != " " { log . Infof ( " " , name , timestampNow ( ) - node . heartbeat ) } for digest , config := range node . digestToConfig { delete ( d . store . digestToNode , digest ) log . Debugf ( " " , config . Name , digest ) d . store . danglingConfigs [ digest ] = config danglingConfigs . Inc ( le . JoinLeaderValue ) } delete ( d . store . nodes , name ) nodeAgents . Dec ( le . JoinLeaderValue ) dispatchedConfigs . Delete ( name , le . JoinLeaderValue ) statsCollectionFails . Delete ( name , le . JoinLeaderValue ) busyness . Delete ( name , le . JoinLeaderValue ) } node . RUnlock ( ) } if initialNodeCount != 0 && len ( d . store . nodes ) == 0 { log . Warn ( " " ) } }
expireNodes iterates over nodes and removes the ones that have not
reported for more than the expiration duration.
expireNodes iterates over nodes and removes the ones that have not reported for more than the expiration duration .
// Don't report on the dummy "" host for unscheduled configs // Remove metrics linked to this node