I’m making queries to the AWS API, which has a throttle on the number of calls per second you can make.
Unfortunately some of their actions take a single object (instead of a list), which forces me to generate one call per object. That means that sometimes I end up generating hundreds of individual call to the API, which breaks their limit rate of a 100 req per second if they’re all running at the same time.
I tried using Task.sequence to make sure they don’t run concurrently, but those requests complete very quickly and I’m still breaking the rate limit of the API sometimes. An easy fix would be to retry until it works, but that’s very dirty.
What would be a good way to get those hundreds of Cmd to be throttled, maybe run one every 100ms or something of that effect ?
The only thing I can think of would be to queue them in the model and have update be called every 100ms to unqueue them. I’m kind of hopin there’s an easier way, something like
Cmd.batchThrottled 100 myVeryLongList for example.