statsig-io / node-js-server-sdk

Statsig's SDK for server-side Node.js applications.
ISC License
20 stars 15 forks source link

feat(flush): added retries and backoff as optional parameters to Statsig.flush #25

Closed cajubelt closed 1 year ago

cajubelt commented 1 year ago

My team noticed some timeouts in our own company's endpoints that were caused by Statsig flushes taking too long. Our endpoints are serverless, so the flush needed to take place before we could send a response, which terminates the process. 10 seconds was way too long, but without a backoff parameter we were unable to do anything about it, or even disable retries if we wanted to. Our best alternative was using Promise.race to terminate if flushing was taking too long, but that seemed like a hack, and would still mean adding 10 seconds to our response times for a single retry. This is a non-breaking change that solves our problem, and will hopefully be useful for other Statsig users too.

kenny-statsig commented 1 year ago

Thanks for the suggestion. We will apply this change in our next release version.

kenny-statsig commented 1 year ago

Added in v5.6.0