Просмотр исходного кода

Merge pull request #12763 from SergeTupchiy/EMQX-1206-ds-mqueue-inflight-api-not-implemented

fix: return not_implemented error for mqueue/inflight msgs queries
SergeTupchiy 1 год назад
Родитель
Сommit
c2ace30318

+ 3 - 1
apps/emqx/src/emqx_persistent_session_ds.erl

@@ -264,7 +264,9 @@ info(awaiting_rel_max, #{props := Conf}) ->
 info(await_rel_timeout, #{props := _Conf}) ->
     %% TODO: currently this setting is ignored:
     %% maps:get(await_rel_timeout, Conf).
-    0.
+    0;
+info({MsgsQ, _PagerParams}, _Session) when MsgsQ =:= mqueue_msgs; MsgsQ =:= inflight_msgs ->
+    {error, not_implemented}.
 
 -spec stats(session()) -> emqx_types:stats().
 stats(Session) ->

+ 8 - 0
apps/emqx_management/src/emqx_mgmt_api_clients.erl

@@ -942,6 +942,9 @@ client_msgs_schema(OpId, Desc, ContExample, RespSchema) ->
                     ),
                 404 => emqx_dashboard_swagger:error_codes(
                     ['CLIENTID_NOT_FOUND'], <<"Client ID not found">>
+                ),
+                ?NOT_IMPLEMENTED => emqx_dashboard_swagger:error_codes(
+                    ['NOT_IMPLEMENTED'], <<"API not implemented">>
                 )
             }
         }
@@ -1217,6 +1220,11 @@ list_client_msgs(MsgType, ClientID, QString) ->
             case emqx_mgmt:list_client_msgs(MsgType, ClientID, PagerParams) of
                 {error, not_found} ->
                     {404, ?CLIENTID_NOT_FOUND};
+                {error, not_implemented} ->
+                    {?NOT_IMPLEMENTED, #{
+                        code => 'NOT_IMPLEMENTED',
+                        message => <<"API not implemented for persistent sessions">>
+                    }};
                 {Msgs, Meta = #{}} when is_list(Msgs) ->
                     format_msgs_resp(MsgType, Msgs, Meta, QString)
             end