Skip to content

Commit

Permalink
add worker for refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
iostream1308 committed Feb 14, 2025
1 parent 1bdaf1f commit ffadf9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion v2/cmd/tradelogs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func run(c *cli.Context) error {
}
dashStorage := dashboardStorage.New(l, db)
mviewRefresher := worker.NewRefresher(dashStorage, l)
go mviewRefresher.ScheduleMViewRefresh()
go mviewRefresher.Run()
s := server.NewTradeLogs(l, storage, dashStorage, c.String(libapp.HTTPTradeLogsServerFlag.Name))
return s.Run()
}
Expand Down
4 changes: 4 additions & 0 deletions v2/internal/worker/mview_refresher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func NewRefresher(dashStorage *dashboardStorage.Storage, l *zap.SugaredLogger) *
}
}

func (r *Refresher) Run() {
r.ScheduleMViewRefresh()
}

func (r *Refresher) ScheduleMViewRefresh() {
ticker := time.NewTicker(24 * time.Hour)
defer ticker.Stop()
Expand Down

0 comments on commit ffadf9e

Please sign in to comment.