From 196b7d0e3b1236c847a0f9a2fe637a0fdfa6a33b Mon Sep 17 00:00:00 2001 From: ramiroblanco1986 <82423284+ramiroblanco1986@users.noreply.github.com> Date: Fri, 15 Apr 2022 00:35:42 -0300 Subject: [PATCH] Add break to prevent log flooding and API abuse When running into connectivity or authentication problems, getRunnersOrganizationFromGithub gets stucked in a loop flooding the stdout with logs and hitting non-stop the Github API. With a break, if it runs into an error of any sort, it will continue with the next org. If errors occurs with next orgs, it will only fail once and finally after checking all orgs it will pause the specified refresh value. --- pkg/metrics/get_runners_organization_from_github.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/metrics/get_runners_organization_from_github.go b/pkg/metrics/get_runners_organization_from_github.go index b21585c..cb6f8f1 100644 --- a/pkg/metrics/get_runners_organization_from_github.go +++ b/pkg/metrics/get_runners_organization_from_github.go @@ -30,6 +30,7 @@ func getRunnersOrganizationFromGithub() { resp, rr, err := client.Actions.ListOrganizationRunners(context.Background(), orga, opt) if err != nil { log.Printf("ListOrganizationRunners error for %s: %s", orga, err.Error()) + break } else { for _, runner := range resp.Runners { if runner.GetStatus() == "online" {