Reducing max bandwidth by 10% to prevent potential rate limit issues.

This commit is contained in:
Victor Lyuboslavsky 2024-04-01 16:31:38 -05:00
parent e65fe99316
commit af80a7bff7
No known key found for this signature in database

View File

@ -17,6 +17,8 @@ import (
"github.com/go-kit/log/level" "github.com/go-kit/log/level"
) )
const calendarConsumers = 18
func newCalendarSchedule( func newCalendarSchedule(
ctx context.Context, ctx context.Context,
instanceID string, instanceID string,
@ -200,11 +202,10 @@ func processCalendarFailingHosts(
) { ) {
hosts = filterHostsWithSameEmail(hosts) hosts = filterHostsWithSameEmail(hosts)
const consumers = 20
hostsCh := make(chan fleet.HostPolicyMembershipData) hostsCh := make(chan fleet.HostPolicyMembershipData)
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < consumers; i++ { for i := 0; i < calendarConsumers; i++ {
wg.Add(+1) wg.Add(+1)
go func() { go func() {
defer wg.Done() defer wg.Done()
@ -500,11 +501,10 @@ func removeCalendarEventsFromPassingHosts(
}) })
} }
const consumers = 20
emailsCh := make(chan emailWithHosts) emailsCh := make(chan emailWithHosts)
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < consumers; i++ { for i := 0; i < calendarConsumers; i++ {
wg.Add(+1) wg.Add(+1)
go func() { go func() {
defer wg.Done() defer wg.Done()
@ -669,10 +669,9 @@ func deleteCalendarEventsInParallel(
logger kitlog.Logger, logger kitlog.Logger,
) { ) {
if len(calendarEvents) > 0 { if len(calendarEvents) > 0 {
const consumers = 20
calendarEventCh := make(chan *fleet.CalendarEvent) calendarEventCh := make(chan *fleet.CalendarEvent)
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < consumers; i++ { for i := 0; i < calendarConsumers; i++ {
wg.Add(+1) wg.Add(+1)
go func() { go func() {
defer wg.Done() defer wg.Done()