massive-com / massive-com/client-go

Add RateLimiter to List iter functions.

Open
#485 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
198
Forks
59
Avg merge
33m
Merged PRs (30d)
2

Description

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()
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the ListAggs entry point, its iterator implementation, and the iter.Next path described in the issue. Determine how options are passed and how concurrent iteration issues requests; done means a caller can supply a rate limiter that governs requests throughout iteration, with behavior covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.