mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2025-08-07 00:58:12 +00:00
Add random sleep when refreshing Topics
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -92,7 +93,8 @@ func (a *App) refreshTopics() {
|
|||||||
log.Debug().Msg("Refreshing topics")
|
log.Debug().Msg("Refreshing topics")
|
||||||
a.CurrentTopics = latestTopics
|
a.CurrentTopics = latestTopics
|
||||||
a.LastRefresh = time.Now()
|
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