When I wrote this in go I used a go routine as a spawner and would spawn api keys and put them into a channel at an interval that would most likely not exceed the rate limit. This had the added benefit that any other goroutine looking to call the api would be blocking until there was an available apikey and I could have multiple spawners putting in diff api keys (they're rate limited by key not ip). I did have to flush them every minute or so if they wernt being used... overall not sure that was the best system but I liked it.
I guess whats the most idiomatic way to do something like this?
I'm not tied to channels or even threads and workers really jsut wanna ensure that every call to the api is appropriately spaced such that it doesnt crater an api key.
Thanks, qez