Skip to content

Commit 7631e7a

Browse files
committed
fix: periodically update metrics from database
1 parent dd42076 commit 7631e7a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

internal/bot/bot.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,13 @@ func Start(botConfig config.Config) {
490490

491491
// Periodically update the metrics from the database
492492
go func() {
493-
prometheus.TotalUniquePriceagentsValue = database.GetPriceAgentCount()
494-
prometheus.TotalUniqueUsersValue = database.GetUserCount()
495-
prometheus.TotalUniqueWishlistPriceagentsValue = database.GetPriceAgentWishlistCount()
496-
prometheus.TotalUniqueProductPriceagentsValue = database.GetPriceAgentProductCount()
497-
time.Sleep(time.Second * 60)
493+
for {
494+
prometheus.TotalUniquePriceagentsValue = database.GetPriceAgentCount()
495+
prometheus.TotalUniqueUsersValue = database.GetUserCount()
496+
prometheus.TotalUniqueWishlistPriceagentsValue = database.GetPriceAgentWishlistCount()
497+
prometheus.TotalUniqueProductPriceagentsValue = database.GetPriceAgentProductCount()
498+
time.Sleep(time.Second * 60)
499+
}
498500
}()
499501
}
500502

0 commit comments

Comments
 (0)