fix(shared): send to sub anyway

This commit is contained in:
Georgy Sychev 2022-05-24 15:22:06 +04:00
parent 1a5293e4b4
commit e175b3a1d6
1 changed files with 6 additions and 4 deletions

View File

@ -286,15 +286,17 @@ do_pick(Strategy, ClientId, SourceTopic, Group, Topic, FailedSubs) ->
%% Genuinely no subscriber %% Genuinely no subscriber
false; false;
[] -> [] ->
%% All offline? pick one anyway %% We try redispatch to subs who dropped the message because inflight was full.
%% We redispatch only to subs who dropped the message because inflight was full.
Found = 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),
case Found of case Found of
error -> false;
{ok, Dropped} -> {ok, Dropped} ->
{retry, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, [Dropped])} %% Found dropped client
{retry, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, [Dropped])};
error ->
%% All offline? pick one anyway
{retry, pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, All)}
end; end;
Subs -> Subs ->
%% More than one available %% More than one available