Commit a87dd175 by Emil Tullstedt Committed by GitHub

UsageStats: Purpose named variables (#31264)

parent 8f20b13f
...@@ -54,18 +54,18 @@ func (uss *UsageStatsService) Init() error { ...@@ -54,18 +54,18 @@ func (uss *UsageStatsService) Init() error {
func (uss *UsageStatsService) Run(ctx context.Context) error { func (uss *UsageStatsService) Run(ctx context.Context) error {
uss.updateTotalStats() uss.updateTotalStats()
onceEveryDayTick := time.NewTicker(time.Hour * 24) sendReportTicker := time.NewTicker(time.Hour * 24)
everyMinuteTicker := time.NewTicker(time.Minute * 30) updateStatsTicker := time.NewTicker(time.Minute * 30)
defer onceEveryDayTick.Stop() defer sendReportTicker.Stop()
defer everyMinuteTicker.Stop() defer updateStatsTicker.Stop()
for { for {
select { select {
case <-onceEveryDayTick.C: case <-sendReportTicker.C:
if err := uss.sendUsageStats(ctx); err != nil { if err := uss.sendUsageStats(ctx); err != nil {
metricsLogger.Warn("Failed to send usage stats", "err", err) metricsLogger.Warn("Failed to send usage stats", "err", err)
} }
case <-everyMinuteTicker.C: case <-updateStatsTicker.C:
uss.updateTotalStats() uss.updateTotalStats()
case <-ctx.Done(): case <-ctx.Done():
return ctx.Err() return ctx.Err()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment