From 45111de3fb8f525909668e094397fdda0294fc5a Mon Sep 17 00:00:00 2001 From: Chris Grindstaff Date: Mon, 23 Sep 2024 09:11:57 -0400 Subject: [PATCH] fix: `bin/harvest rest` should read credentials before fetching data --- cmd/tools/rest/rest.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/tools/rest/rest.go b/cmd/tools/rest/rest.go index 3ef8d15a2..f237ebebd 100644 --- a/cmd/tools/rest/rest.go +++ b/cmd/tools/rest/rest.go @@ -280,6 +280,17 @@ func doData() { pollers = append(pollers, args.Poller) } + // Prime the credential cache before forking goroutines + for _, pollerName := range pollers { + p, _, err := GetPollerAndAddr(pollerName) + if err != nil { + stderr("failed to get poller %s err: %+v\n", pollers[0], err) + continue + } + cred := auth.NewCredentials(p, slog.Default()) + _, _ = cred.GetPollerAuth() + } + for _, pollerName := range pollers { go func(pollerName string) { var (