fix: increase batch payload size limit from 32KB#110
Merged
Conversation
The 32KB limit was inherited from 6yo library and is far too restrictive. The PostHog /batch/ endpoint accepts up to 20MB, and the Python SDK already uses a 5MB limit.
Contributor
Author
marandaneto
reviewed
Mar 28, 2026
marandaneto
reviewed
Mar 30, 2026
lib/Consumer/ForkCurl.php
Outdated
| if (strlen($payload) >= self::MAX_BATCH_PAYLOAD_SIZE) { | ||
| if ($this->debug()) { | ||
| $msg = "Message size is larger than 32KB"; | ||
| $msg = "Message size is larger than " . (self::MAX_BATCH_PAYLOAD_SIZE / 1024) . "KB"; |
Member
There was a problem hiding this comment.
self::MAX_BATCH_PAYLOAD_SIZE / 1024
can could also be a const, no need to divide every single time
Member
There was a problem hiding this comment.
same for libcurl, socket, etc
Contributor
Author
There was a problem hiding this comment.
yeah I thought about it too, forgot arithmetic / concatenation works with const initializers in PHP too 😆 wanted to go the full "human readable stringification" route but not worth the extra logic currently; keeping it a separate const is 👍, updated
marandaneto
approved these changes
Mar 30, 2026
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.
Summary
/batch/endpoint accepts up to 20MBChanges
lib/Consumer/ForkCurl.php-32 * 1024->1 * 1024 * 1024lib/Consumer/LibCurl.php- samelib/Consumer/Socket.php- sameTest plan