Skip to content

Commit

Permalink
fix: updated event size limit in request (#41)
Browse files Browse the repository at this point in the history
* Updated event size limit

* Updated batch size limit

* fix: updated test to reflect the updated batch limit
  • Loading branch information
arnab-p authored Sep 24, 2024
1 parent 73f1a72 commit ff1f2f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rudderstack/analytics/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

from queue import Empty

MAX_MSG_SIZE = 32 << 10
MAX_MSG_SIZE = 4 << 10 << 10 ## 4 mb

# Our servers only accept batches less than 500KB. Here limit is set slightly
# lower to leave space for extra data that will be added later, eg. "sentAt".
BATCH_SIZE_LIMIT = 475000
BATCH_SIZE_LIMIT = 4 << 10 << 10 ## 4 mb


class Consumer(Thread):
Expand Down Expand Up @@ -94,7 +94,7 @@ def next(self):
item, cls=DatetimeSerializer).encode())
if item_size > MAX_MSG_SIZE:
self.log.error(
'Item exceeds 32kb limit, dropping. (%s)', str(item))
'Item exceeds 4mb limit, dropping. (%s)', str(item))
continue
items.append(item)
total_size += item_size
Expand Down
2 changes: 1 addition & 1 deletion rudderstack/analytics/test/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_max_batch_size(self):
}
msg_size = len(json.dumps(track).encode())
# number of messages in a maximum-size batch
n_msgs = int(475000 / msg_size)
n_msgs = int((4 << 10 << 10) / msg_size)

def mock_post_fn(_, data, **kwargs):
res = mock.Mock()
Expand Down

0 comments on commit ff1f2f0

Please sign in to comment.