-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Using analytics-go.v3
.
The Client
interface has a comment that outlines the client setup:
// client := analytics.New(writeKey)
// ...
// client.Enqueue(analytics.Track{ ... })
// ...
// client.Close()
I'm doing that, but get a very occasional error like segment 2019/09/16 13:43:38 ERROR: 15 messages dropped because they failed to be sent and the client was closed
. From the code it looks like I hit a failure to send, but the client.Close()
call happened before the retry was attempted. Calling client.Close()
closes the quit
channel, printing that error message and dropping the unsent messages.
Is there currently a way to check if all messages sent before calling client.Close()
? I did see the config.Callback but that doesn't seem like it's what I want, as I want to make sure ALL messages have sent or failed all retries before calling client.Close()
.
I should also add that I'm running this in AWS lambda so I'd rather not just add a sleep
before calling Close().
Thanks!