From af80a7bff73f55622b96d0e46bbd8e2d17a46f17 Mon Sep 17 00:00:00 2001 From: Victor Lyuboslavsky Date: Mon, 1 Apr 2024 16:31:38 -0500 Subject: [PATCH] Reducing max bandwidth by 10% to prevent potential rate limit issues. --- cmd/fleet/calendar_cron.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/fleet/calendar_cron.go b/cmd/fleet/calendar_cron.go index cc69457ad..54bd89f55 100644 --- a/cmd/fleet/calendar_cron.go +++ b/cmd/fleet/calendar_cron.go @@ -17,6 +17,8 @@ import ( "github.com/go-kit/log/level" ) +const calendarConsumers = 18 + func newCalendarSchedule( ctx context.Context, instanceID string, @@ -200,11 +202,10 @@ func processCalendarFailingHosts( ) { hosts = filterHostsWithSameEmail(hosts) - const consumers = 20 hostsCh := make(chan fleet.HostPolicyMembershipData) var wg sync.WaitGroup - for i := 0; i < consumers; i++ { + for i := 0; i < calendarConsumers; i++ { wg.Add(+1) go func() { defer wg.Done() @@ -500,11 +501,10 @@ func removeCalendarEventsFromPassingHosts( }) } - const consumers = 20 emailsCh := make(chan emailWithHosts) var wg sync.WaitGroup - for i := 0; i < consumers; i++ { + for i := 0; i < calendarConsumers; i++ { wg.Add(+1) go func() { defer wg.Done() @@ -669,10 +669,9 @@ func deleteCalendarEventsInParallel( logger kitlog.Logger, ) { if len(calendarEvents) > 0 { - const consumers = 20 calendarEventCh := make(chan *fleet.CalendarEvent) var wg sync.WaitGroup - for i := 0; i < consumers; i++ { + for i := 0; i < calendarConsumers; i++ { wg.Add(+1) go func() { defer wg.Done()