Skip to content

Commit

Permalink
Merge pull request #44 from mrpalide/fix/add-shuffle-on-entries-list-…
Browse files Browse the repository at this point in the history
…of-dmsg-monitor

Optimize dmsg-monitor
  • Loading branch information
mrpalide authored Jan 9, 2024
2 parents 3b74615 + 4a53cab commit c66f356
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/dmsg-monitor/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -169,7 +170,10 @@ func (api *API) dmsgDeregistration(uptimes map[string]bool) {
api.logger.Warnf("Error occur during get dmsg clients list due to %s", err)
return
}

//randomize the order of the dmsg entries
rand.Shuffle(len(clients), func(i, j int) {
clients[i], clients[j] = clients[j], clients[i]
})
// check dmsg clients either alive or dead
checkerConfig := dmsgCheckerConfig{
wg: new(sync.WaitGroup),
Expand Down

0 comments on commit c66f356

Please sign in to comment.