-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Allow sending webhook events in batches #249
Conversation
DRY concept on sendSimple and sendWebhookByBatching Renames
This PR is awesome. 😀 So for the sake of simplicity, I added I've cleaned up some code and moved it into its own class and rewrote it a bit to not look so duplicated. I have to say that increasing the duration of batch-keeping to more than Even if I re-wrote a bit the PR, you did a great job. Please let me know if this version works well for you. |
Codecov Report
@@ Coverage Diff @@
## master #249 +/- ##
==========================================
- Coverage 85.00% 84.57% -0.43%
==========================================
Files 40 40
Lines 1881 1900 +19
Branches 337 343 +6
==========================================
+ Hits 1599 1607 +8
- Misses 272 282 +10
- Partials 10 11 +1
Continue to review full report at Codecov.
|
Wow, that was quick! 😁 Yeah all those changes make sense! and the batch duration is great - wish pusher had that! |
I was already trying to merge some PRs so I could respond quickly. 😁 |
Currently when firing off web-hooks based on events, there's no batching in place, so 1000 client events === 1000 web-hooks. This can cause a lot of overhead at a high scale. This PR introduces a feature which allows you to send multiple events in one web-hook, if the events were made at very similar times (within 50ms of each-other).
In our case, we're receiving 100,000 client events over 10 seconds, so this reduces a lot of overhead.
I've attached an image, where the red box shows invocations of my lambda "web-hook" when WEBHOOK_BATCHING is set to 0, and the green box shows the same action taken when set to 1.
I'm pretty new to this, so let me know if you want me to add, remove, or rework anything :)