From e175b3a1d649f3b3b0af4ec4310af95389ca0dde Mon Sep 17 00:00:00 2001 From: Georgy Sychev Date: Tue, 24 May 2022 15:22:06 +0400 Subject: [PATCH] fix(shared): send to sub anyway --- src/emqx_shared_sub.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/emqx_shared_sub.erl b/src/emqx_shared_sub.erl index f2feceaf0..9eb2b1d5b 100644 --- a/src/emqx_shared_sub.erl +++ b/src/emqx_shared_sub.erl @@ -286,15 +286,17 @@ do_pick(Strategy, ClientId, SourceTopic, Group, Topic, FailedSubs) -> %% Genuinely no subscriber false; [] -> - %% All offline? pick one anyway - %% We redispatch only to subs who dropped the message because inflight was full. + %% We try redispatch to subs who dropped the message because inflight was full. Found = maps_find_by(FailedSubs, fun({SubPid, FailReason}) -> FailReason == dropped andalso is_alive_sub(SubPid) end), case Found of - error -> false; {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; Subs -> %% More than one available