Skip to content

Commit

Permalink
switch from channel to simple sleepingClusterChecks global map
Browse files Browse the repository at this point in the history
  • Loading branch information
xorpaul committed Jan 9, 2020
1 parent cbb511d commit bb0b756
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,11 @@ func restartHandlerV1(w http.ResponseWriter, r *http.Request) {
res.Message = result.Reason
res.Goahead = true
triggerRebootGoaheadActions(request.Fqdn, res.FoundCluster, request.Uptime, clusterLogger)
clusterLogger.Debug("Activating cluster checker for " + request.Fqdn + " inside cluster " + res.FoundCluster)
select {
case checkCluster <- clusterCheck{clusterSettings[c], request.Fqdn, rid, res.FoundCluster}:
default:
clusterLogger.Info("Activating cluster checker for " + request.Fqdn + " inside cluster " + res.FoundCluster)
mutex.Lock()
if _, ok := sleepingClusterChecks[res.RequestingFqdn]; !ok {
sleepingClusterChecks[request.Fqdn] = clusterCheck{clusterSettings[c], request.Fqdn, rid, res.FoundCluster}
mutex.Unlock()
}
} else {
res.Message = result.Reason
Expand Down

0 comments on commit bb0b756

Please sign in to comment.