From bb0b75639e1d9065bdc9fd9b500aabc84b188c91 Mon Sep 17 00:00:00 2001 From: Andreas Paul Date: Thu, 9 Jan 2020 17:26:35 +0100 Subject: [PATCH] switch from channel to simple sleepingClusterChecks global map --- v1.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/v1.go b/v1.go index 067d781..97cd9c0 100644 --- a/v1.go +++ b/v1.go @@ -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