Add rate-limiter to forwarder#16
Merged
Merged
Conversation
cleptric
reviewed
Apr 15, 2025
cleptric
reviewed
May 12, 2025
| $envelope->rejectItems(static function (EnvelopeItem $envelopeItem) use ($rateLimiter) { | ||
| $envelopeItemType = $envelopeItem->getItemType(); | ||
|
|
||
| // @TODO: We should make the rate limiter accept an arbitrary item type to allow for flexibility when adding new item types |
Collaborator
Author
There was a problem hiding this comment.
When released we can remove the TODO, will do in followup PR.
cleptric
approved these changes
May 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have added a few TODO's, I think I know the answer but I wanted to check, I think we need to inspect and parse the full envelope content to be able to determine if we are required to rate limit (parts) of the submitted envelope.
I think currently the PHP SDK doesn't submit any envelope with more than 1 item in it but with my eye on logging this might change. If not, and they are still 1 item with many items we could get away with the current state of envelope parsing.
We could luckily re-use the SDK rate limiter class pretty easily (only the event type parsing is a little... meh).
Fixes #12