Skip to content

Commit

Permalink
Fix flush api (#21)
Browse files Browse the repository at this point in the history
* Fix flush api

* Add a flush() call as well to test
  • Loading branch information
tore-statsig authored Apr 26, 2023
1 parent 3739ae8 commit af96560
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Statsig.MixProject do
def project() do
[
app: :statsig,
version: "0.0.1",
version: "0.0.2",
elixir: "~> 1.0",
deps: deps(),
description: description(),
Expand Down
2 changes: 1 addition & 1 deletion src/statsig_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ handle_cast(
Event = logging:get_event(User, EventName, Value, Metadata),
{noreply, [{log_events, [Event | Events]}, {api_key, ApiKey}, {last_sync_time, Time}]};

handle_cast(flush, [{log_events, Events}, {api_key, ApiKey}, {last_sync_time, Time}]) ->
handle_cast({flush}, [{log_events, Events}, {api_key, ApiKey}, {last_sync_time, Time}]) ->
Unsent = handle_events(Events, ApiKey),
{noreply, [{log_events, Unsent}, {api_key, ApiKey}, {last_sync_time, Time}]}.

Expand Down
2 changes: 1 addition & 1 deletion src/utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ get_statsig_metadata() ->
}.

-spec get_sdk_version() -> list().
get_sdk_version() -> "0.1.0".
get_sdk_version() -> "0.0.2".

-spec get_sdk_type() -> list().
get_sdk_type() -> "erlang-server".
Expand Down
2 changes: 2 additions & 0 deletions test/consistency_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ gate_test() ->
statsig:log_event(#{<<"userID">> => <<"456">>}, <<"custom_event">>, <<"hello">>, #{<<"123">> => <<"444">>}),
statsig:log_event(#{<<"userID">> => <<"12345">>}, <<"custom_event">>, #{<<"test">> => <<"val">>}),
statsig:flush_sync(),
statsig:log_event(#{<<"userID">> => <<"12345">>}, <<"custom_event">>, #{<<"test">> => <<"val">>}),
statsig:flush(),
application:stop(statsig).

test_input(Input) ->
Expand Down

0 comments on commit af96560

Please sign in to comment.