Skip to content

Commit

Permalink
add mongodb tokens update after restart
Browse files Browse the repository at this point in the history
  • Loading branch information
n0str authored and n0str committed Dec 3, 2024
1 parent 2df0bb1 commit 86bf099
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func (x *RunCommand) Execute(args []string) error {
// connect to accounts MongoDB
doneAccountsContext := make(chan struct{})
accountsClient := accounts.New(cfg.AccountsMongoDBURI)

err = accountsClient.UpdateTokenCache()
if err != nil {
log.Errorf("failed to update token cache: %s", err)
}

go periodic.RunPeriodically(accountsClient.UpdateTokenCache, cfg.TokenUpdatePeriod, doneAccountsContext)
defer close(doneAccountsContext)

Expand Down

0 comments on commit 86bf099

Please sign in to comment.