2 Commits

Author SHA1 Message Date
renovate[bot]
9b583c5fe0 Update docker/dockerfile Docker tag to v1.13 2025-01-25 20:29:38 +00:00
Dave Gallant
5dd59be6aa Only refresh topics if the list is non-empty
If the rfd api returns an empty list of topics (i.e. it's down), do not refresh
the topics list.
2025-01-25 15:15:03 -05:00
2 changed files with 9 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.12
# syntax=docker/dockerfile:1.13
FROM cgr.dev/chainguard/go:latest as build
WORKDIR /src

View File

@@ -91,12 +91,15 @@ func (a *App) refreshTopics() {
for {
log.Info().Msg("Refreshing topics")
latestTopics := a.getDeals(9, 1, 6)
latestTopics = a.updateScores(latestTopics)
log.Info().Msg("Refreshing redirects")
latestRedirects := a.getRedirects()
a.Redirects = latestRedirects
a.CurrentTopics = a.stripRedirects(latestTopics)
if len(latestTopics) > 0 {
latestTopics = a.updateScores(latestTopics)
log.Info().Msg("Refreshing redirects")
latestRedirects := a.getRedirects()
a.Redirects = latestRedirects
a.CurrentTopics = a.stripRedirects(latestTopics)
}
a.LastRefresh = time.Now()
rand.Seed(time.Now().UnixNano())