mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2025-08-06 07:13:39 +00:00
Add random sleep when refreshing Topics
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user