statsig-io / erlang-sdk

The statsig feature flagging and experimentation library for erlang/elixir
ISC License
5 stars 2 forks source link

The `last_sync_time` is not updated. #23

Closed matt-hobbs-prima closed 1 year ago

matt-hobbs-prima commented 1 year ago

When further flushes are completed, the genservers last_sync_time state is not updated. This should happen around here (statsig_server.erl)

handle_info(download_specs, [{log_events, Events}, {api_key, ApiKey}, {last_sync_time, Time}]) ->
  case network:request(ApiKey, "download_config_specs", #{<<"sinceTime">> => Time}) of
    false -> unknown;
    Body -> parse_and_save_specs(Body)

instead the original state time is used.

tore-statsig commented 1 year ago

Ah interesting. We actually have a test case for this so I was surprised to see the issue - but the test case only checks that the first sync sets time to 0, and the second sync updates the time. But in this case, its any sync after that.

I can correct this

tore-statsig commented 1 year ago

To be clear - this wont impact the sdk that much - it will redownload the entire rule definition every time, but everything should be working. Testing the fix now though

tore-statsig commented 1 year ago

fixed in https://github.com/statsig-io/erlang-sdk/commit/cd16a281a885c870aabd8f108453fe3f281405ec