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