You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Batching
... If batch messages are not arriving in your debugger and no error is being thrown you may want to slow the speed of your scipt down. This is because we run a message batching loop in a go-routine so if the script runs too fast it won’t execute on the network calls before it exits the loop.
By default, our library will flush:
every 20 messages (control with FlushAt)
if 5 seconds has passed since the last flush (control with FlushAfter)
There is a maximum of 500KB per batch request and 32KB per call.
Sometimes you might not want batching (eg. when debugging, or in short-lived programs). You can turn off batching by setting the FlushAt argument to 1, and your requests will always be sent right away.
I am running in AWS Lambda which could be fairly short lived (instances are reused for multiple executions, which means it may be long lived) but if i defer client.Close() from the code it is supposed to flush the queue and send all messages, right?
The docs make it sound like i need to set my batch size to 1 for short lived programs or scripts but I don't understand why I need to do that if client.Close() sends all queued messages anyway?
This issue raised #157 also confuses me, if client.Close() sends all queued messages then there is no need to check first?
The text was updated successfully, but these errors were encountered:
From docs on Batching: (https://segment.com/docs/connections/sources/catalog/libraries/server/go/#batching)
I am running in AWS Lambda which could be fairly short lived (instances are reused for multiple executions, which means it may be long lived) but if i
defer client.Close()
from the code it is supposed to flush the queue and send all messages, right?The docs make it sound like i need to set my batch size to 1 for short lived programs or scripts but I don't understand why I need to do that if client.Close() sends all queued messages anyway?
This issue raised #157 also confuses me, if client.Close() sends all queued messages then there is no need to check first?
The text was updated successfully, but these errors were encountered: