Skip to content

Add RateLimiter to List iter functions. #485

@nathanhack

Description

@nathanhack

Is your feature request related to a problem? Please describe.
Currently when using a List function it provides no way to mitigate rate limit errors.

Describe the solution you'd like
Ideally a way to rate limit requests. It could be achieved by passing in a ratelimiter interface to the function either as a new function parameter, in params, or as an option.

type RateLimiter interface{
     Take()
}

Given the current interface I would claim creating a new ratelimiter option is the cleanest/easiest way.

Describe alternatives you've considered
Currently the only way to incorporate a rate limiter is before the initial List function and then before the iter.Next() function is called. But in a concurrent application this is insufficient.

ratelimiter.Take()
iter := c.ListAggs(context.TODO(), params, opts...)
for iter.Next() {
	log.Print(iter.Item()) // do something with the current value
        ratelimiter.Take()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions