Skip to content

Commit

Permalink
fix: guard add_event cast with event capacity check
Browse files Browse the repository at this point in the history
  • Loading branch information
vlymar committed Dec 21, 2023
1 parent 6890db7 commit 9d7bde3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ldclient_event_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ handle_call({flush, Tag}, _From, #{events := Events, summary_event := SummaryEve
NewTimerRef = erlang:send_after(FlushInterval, self(), {flush, Tag}),
{reply, ok, State#{events := [], summary_event := #{}, timer_ref := NewTimerRef}}.

handle_cast({add_event, Event, Tag, Options}, #{events := Events, summary_event := SummaryEvent, capacity := Capacity} = State) ->
handle_cast({add_event, Event, Tag, Options}, #{events := Events, summary_event := SummaryEvent, capacity := Capacity} = State) when length(Events) < Capacity ->
{NewEvents, NewSummaryEvent} = add_event(Tag, Event, Options, Events, SummaryEvent, Capacity),
{noreply, State#{events := NewEvents, summary_event := NewSummaryEvent}};
handle_cast(_Request, State) ->
Expand Down

0 comments on commit 9d7bde3

Please sign in to comment.