statsig-io / node-js-server-sdk

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

StatsigFetcher._retry breaks timeout logic #49

Closed andrzej-woof closed 1 month ago

andrzej-woof commented 1 month ago

Hi, I believe handling of abort signal is broken in general. First of all StatsigFetcher._retry doesn't receive or pass that in any way. But even if it did it would have to create new signal each time, and since only signal is passed to the fetcher one cannot reliably know the timeout value with which it was constructed.

Consider the following scenario of invoking StatsigServer.flush function

await Statsig.flush(100); // manually flush any unsent events

It takes timeout as parameter and an abort controller is created and signal is being passed further down. However if that request fails a retry request will be issued without any signal passed

tore-statsig commented 1 month ago

Thanks for the report, we are taking a look

tore-statsig commented 1 month ago

Fixed in https://github.com/statsig-io/node-js-server-sdk/releases/tag/5.25.1