Skip to content

Commit

Permalink
Fixed incorrect send_after that would cause the aggregation windows t…
Browse files Browse the repository at this point in the history
…o become bigger than 1 second, resulting in incorrect statistics (too high rps for example)
  • Loading branch information
knutin committed Sep 5, 2012
1 parent 9ebd040 commit e389287
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/elli_stats_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ handle_cast({incr, Key, Amount}, State) ->


handle_info(push, #state{subscribers = Subscribers} = State) ->
erlang:send_after(1000, self(), push),

Stats = get_stats(State#state.name, State#state.elli_controller),
Chunk = iolist_to_binary(["data: ", jiffy:encode(Stats), "\n\n"]),
NewSubscribers = notify_subscribers(Subscribers, Chunk),

erlang:send_after(1000, self(), push),
{noreply, State#state{subscribers = NewSubscribers}};

handle_info(_Info, State) ->
Expand Down

0 comments on commit e389287

Please sign in to comment.