fix(shared): retab and dropped handling

This commit is contained in:
Georgy Sychev 2022-05-23 15:38:40 +04:00
parent 5cc778ff30
commit fae054bf0e
2 changed files with 14 additions and 10 deletions

View File

@ -288,10 +288,14 @@ do_pick(Strategy, ClientId, SourceTopic, Group, Topic, FailedSubs) ->
[] -> [] ->
%% All offline? pick one anyway %% All offline? pick one anyway
%% We redispatch only to subs who dropped the message because inflight was full. %% We redispatch only to subs who dropped the message because inflight was full.
Dropped = maps_find_by(FailedSubs, fun({SubPid, FailReason}) -> Found = maps_find_by(FailedSubs, fun({SubPid, FailReason}) ->
FailReason == dropped andalso is_alive_sub(SubPid) FailReason == dropped andalso is_alive_sub(SubPid)
end), end),
{retry, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, Dropped)}; case Found of
error -> false;
{ok, Dropped} ->
{retry, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, [Dropped])}
end;
Subs -> Subs ->
%% More than one available %% More than one available
{fresh, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, Subs)} {fresh, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, Subs)}

View File

@ -1,4 +1,4 @@
%fresh, fresh, fresh, %-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2018-2022 EMQ Technologies Co., Ltd. All Rights Reserved. %% Copyright (c) 2018-2022 EMQ Technologies Co., Ltd. All Rights Reserved.
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");