Add random sleep when refreshing Topics

This commit is contained in:
Dave Gallant
2023-02-07 22:13:08 -05:00
parent 0298ea1b2a
commit ad075baa90

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"os"
"strings"
@@ -92,7 +93,8 @@ func (a *App) refreshTopics() {
log.Debug().Msg("Refreshing topics")
a.CurrentTopics = latestTopics
a.LastRefresh = time.Now()
time.Sleep(60 * time.Second)
rand.Seed(time.Now().UnixNano())
time.Sleep(time.Duration(rand.Intn(90 - 60 + 1) + 60) * time.Second)
}
}