Documentation
¶
Index ¶
- Constants
- func ConcurrentStartBatch(ctx context.Context, count, limit int, fn func(index int) error) (int, error)
- func ConcurrentStartBatchDefault(ctx context.Context, count int, fn func(index int) error) (int, error)
- func SlowStartBatch(count, initialBatchSize int, fn func(i int) error) (int, error)
- func SlowStartBatchDefault(count int, fn func(i int) error) (int, error)
Constants ¶
const ( // When batching pod creates, SlowStartInitialBatchSize is the size of the // initial batch. The size of each successive batch is twice the size of // the previous batch. SlowStartInitialBatchSize = 1 // When batching requests, ConcurrentLimitDefault is the maximum number of // concurrent requests allowed to be in-flight at any given time. ConcurrentLimitDefault = 32 )
Variables ¶
This section is empty.
Functions ¶
func ConcurrentStartBatch ¶
func ConcurrentStartBatch(ctx context.Context, count, limit int, fn func(index int) error) (int, error)
ConcurrentStartBatch calls fn for each index in [0, count), with at most limit calls in flight.
If there are any failures, all remaining batches are skipped after waiting for the in-flight batch to complete.
It returns the number of successful calls to the function.
func SlowStartBatch ¶
SlowStartBatch tries to call the provided function a total of 'count' times, starting slow to check for errors, then speeding up if calls succeed.
It groups the calls into batches, starting with a group of initialBatchSize. Within each batch, it may call the function multiple times concurrently with its index.
If a whole batch succeeds, the next batch may get exponentially larger. If there are any failures in a batch, all remaining batches are skipped after waiting for the current batch to complete.
It returns the number of successful calls to the function.
Types ¶
This section is empty.