analytics-android icon indicating copy to clipboard operation
analytics-android copied to clipboard

No flush backoff

Open somehibs opened this issue 2 years ago • 1 comments

DEFAULT_FLUSH_INTERVAL is set to 30s. This is fine for normal network conditions, if somewhat careless with battery usage.

However, under abnormal network conditions and inside an app with a foreground service, the lack of back-off behaviour results in significant wasted modem on time.

This is easily tested by running a DNS blackhole for api.segment.io (return NXDOMAIN, or cause any non-4xx error to be thrown). Instead of slowing requests, Segment wakes up the modem every 30 seconds.

Since there's no back-off functionality available to an SDK consumer, the default interval could probably be increased. This is especially true if the upload exception is caused by network connectivity.

somehibs avatar Mar 12 '22 00:03 somehibs

@somehibs correct. we faced this issue. where we were using our server and server went down, when it came up we received swarm of network hits from segment.

SiddheshShetye avatar Jul 15 '22 07:07 SiddheshShetye