You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project should provide a Throttle class that can be used to limit the throughput to X elements in Y seconds. This can be used in a piping context with or without a Transformer like this:
I've started working on a prototype implementation and it seems to work quite well, but I'd like to flesh out a decent API and address some subtle edge cases before filing this here. For example, do we also need a ReadThrottle or WriteThrottle decorator for readable/writable streams respectively? Also, by throttling before piping to the Transformer, we may end up sending too many requests anyway, so this might be better suited as part of the Transformer instead?
IMHO this mechanism should be independent of a "bandwidth" mechanism, i.e. it should only limit full elements instead of accepting a string data stream that will be broken down into the appropriate number of bytes per time frame. There's definitely also room for this implementation, but I don't see a lot of cohesion with the rest of this package, so this might be better off in a separate package.
The text was updated successfully, but these errors were encountered:
For the reference: Instead of rate limiting using a fixed interval, it's also possible to use a retry mechanism as discussed in #2. This can be used to send at maximum rate until an error is returned in which case a exponential backoff algorithm can be employed to keep retrying at after increasing intervals until the rate is no longer exceeded. While this can cause some failed attempts, it does not require any configuration / prior knowledge of any rate limits.
This project should provide a
Throttle
class that can be used to limit the throughput to X elements in Y seconds. This can be used in a piping context with or without aTransformer
like this:I've started working on a prototype implementation and it seems to work quite well, but I'd like to flesh out a decent API and address some subtle edge cases before filing this here. For example, do we also need a
ReadThrottle
orWriteThrottle
decorator for readable/writable streams respectively? Also, by throttling before piping to theTransformer
, we may end up sending too many requests anyway, so this might be better suited as part of theTransformer
instead?See also clue/reactphp-mq#14 for similar implementation ideas.
IMHO this mechanism should be independent of a "bandwidth" mechanism, i.e. it should only limit full elements instead of accepting a
string
data stream that will be broken down into the appropriate number of bytes per time frame. There's definitely also room for this implementation, but I don't see a lot of cohesion with the rest of this package, so this might be better off in a separate package.The text was updated successfully, but these errors were encountered: