How to calculate queue message size before sending it to queue the way CF does it?
Hey folks,
Any idea of how Cloudflare calculates queue message size before sending it to queue, a worker of mine throws this:
Queue send failed: message length of 165746 bytes exceeds limit of 128000
Because the messages I’m sending to queue can vary in size, I can’t batch the arrays I send to queue by a batchSize because then sometimes it exceeds the limit, what I need is to batch the array based on the size in bytes.
I tried all the things ChatGPT suggested and it’s very different from what CF throws, my calculations usually log around 4000000
bytes while CF throws 165746
0 Replies