refactor(sessds): Unify logic for QoS 1 and 2

This commit is contained in:
ieQu1 2024-02-08 17:41:06 +01:00
parent c781240459
commit 3adbe65a58
1 changed files with 3 additions and 9 deletions

View File

@ -907,17 +907,11 @@ do_enqueue_transient(Msg = #message{qos = Qos}, Session = #{inflight := Inflight
?QOS_0 ->
S = S0,
Inflight = emqx_persistent_session_ds_inflight:push({undefined, Msg}, Inflight0);
?QOS_1 ->
QoS when QoS =:= ?QOS_1; QoS =:= ?QOS_2 ->
SeqNo = inc_seqno(
?QOS_1, emqx_persistent_session_ds_state:get_seqno(?next(?QOS_1), S0)
QoS, emqx_persistent_session_ds_state:get_seqno(?next(QoS), S0)
),
S = emqx_persistent_session_ds_state:put_seqno(?next(?QOS_1), SeqNo, S0),
Inflight = emqx_persistent_session_ds_inflight:push({SeqNo, Msg}, Inflight0);
?QOS_2 ->
SeqNo = inc_seqno(
?QOS_2, emqx_persistent_session_ds_state:get_seqno(?next(?QOS_2), S0)
),
S = emqx_persistent_session_ds_state:put_seqno(?next(?QOS_2), SeqNo, S0),
S = emqx_persistent_session_ds_state:put_seqno(?next(QoS), SeqNo, S0),
Inflight = emqx_persistent_session_ds_inflight:push({SeqNo, Msg}, Inflight0)
end,
Session#{