refactor: rename limiter buffer related messages and var names
This commit is contained in:
parent
8ec3b1db5d
commit
ec19247271
|
@ -552,13 +552,13 @@ handle_msg({quic, Data, _Stream, #{len := Len}}, State) when is_binary(Data) ->
|
||||||
inc_counter(incoming_bytes, Len),
|
inc_counter(incoming_bytes, Len),
|
||||||
ok = emqx_metrics:inc('bytes.received', Len),
|
ok = emqx_metrics:inc('bytes.received', Len),
|
||||||
when_bytes_in(Len, Data, State);
|
when_bytes_in(Len, Data, State);
|
||||||
handle_msg(check_cache, #state{limiter_buffer = Cache} = State) ->
|
handle_msg(check_limiter_buffer, #state{limiter_buffer = Buffer} = State) ->
|
||||||
case queue:peek(Cache) of
|
case queue:peek(Buffer) of
|
||||||
empty ->
|
empty ->
|
||||||
handle_info(activate_socket, State);
|
handle_info(activate_socket, State);
|
||||||
{value, #pending_req{need = Needs, data = Data, next = Next}} ->
|
{value, #pending_req{need = Needs, data = Data, next = Next}} ->
|
||||||
State2 = State#state{limiter_buffer = queue:drop(Cache)},
|
State2 = State#state{limiter_buffer = queue:drop(Buffer)},
|
||||||
check_limiter(Needs, Data, Next, [check_cache], State2)
|
check_limiter(Needs, Data, Next, [check_limiter_buffer], State2)
|
||||||
end;
|
end;
|
||||||
handle_msg(
|
handle_msg(
|
||||||
{incoming, Packet = ?CONNECT_PACKET(ConnPkt)},
|
{incoming, Packet = ?CONNECT_PACKET(ConnPkt)},
|
||||||
|
@ -1036,13 +1036,13 @@ check_limiter(
|
||||||
Data,
|
Data,
|
||||||
WhenOk,
|
WhenOk,
|
||||||
_Msgs,
|
_Msgs,
|
||||||
#state{limiter_buffer = Cache} = State
|
#state{limiter_buffer = Buffer} = State
|
||||||
) ->
|
) ->
|
||||||
%% if there has a retry timer,
|
%% if there has a retry timer,
|
||||||
%% cache the operation and execute it after the retry is over
|
%% Buffer the operation and execute it after the retry is over
|
||||||
%% the maximum length of the cache queue is equal to the active_n
|
%% the maximum length of the buffer queue is equal to the active_n
|
||||||
New = #pending_req{need = Needs, data = Data, next = WhenOk},
|
New = #pending_req{need = Needs, data = Data, next = WhenOk},
|
||||||
{ok, State#state{limiter_buffer = queue:in(New, Cache)}}.
|
{ok, State#state{limiter_buffer = queue:in(New, Buffer)}}.
|
||||||
|
|
||||||
%% try to perform a retry
|
%% try to perform a retry
|
||||||
-spec retry_limiter(state()) -> _.
|
-spec retry_limiter(state()) -> _.
|
||||||
|
@ -1053,7 +1053,7 @@ retry_limiter(#state{limiter = Limiter} = State) ->
|
||||||
{ok, Limiter2} ->
|
{ok, Limiter2} ->
|
||||||
Next(
|
Next(
|
||||||
Data,
|
Data,
|
||||||
[check_cache],
|
[check_limiter_buffer],
|
||||||
State#state{
|
State#state{
|
||||||
limiter = Limiter2,
|
limiter = Limiter2,
|
||||||
limiter_timer = undefined
|
limiter_timer = undefined
|
||||||
|
|
Loading…
Reference in New Issue