浏览代码

fix(exclusive): fix xref error && change exclusive default value

firest 3 年之前
父节点
当前提交
b1b1d40528
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      apps/emqx/src/emqx_exclusive_subscription.erl
  2. 1 1
      apps/emqx/src/emqx_mqtt_caps.erl
  3. 1 1
      apps/emqx/src/emqx_schema.erl

+ 2 - 2
apps/emqx/src/emqx_exclusive_subscription.erl

@@ -70,7 +70,7 @@ check_subscribe(#{clientid := ClientId}, Topic) ->
     Fun = fun() ->
         try_subscribe(ClientId, Topic)
     end,
-    case mnesia:transaction(Fun) of
+    case mria:transaction(?EXCLUSIVE_SHARD, Fun) of
         {atomic, Res} ->
             Res;
         {aborted, Reason} ->
@@ -81,7 +81,7 @@ check_subscribe(#{clientid := ClientId}, Topic) ->
     end.
 
 unsubscribe(Topic, #{is_exclusive := true}) ->
-    _ = mnesia:transaction(fun() -> mnesia:delete({?TAB, Topic}) end),
+    _ = mria:transaction(?EXCLUSIVE_SHARD, fun() -> mnesia:delete({?TAB, Topic}) end),
     ok;
 unsubscribe(_Topic, _SubOpts) ->
     ok.

+ 1 - 1
apps/emqx/src/emqx_mqtt_caps.erl

@@ -68,7 +68,7 @@
     wildcard_subscription => true,
     subscription_identifiers => true,
     shared_subscription => true,
-    exclusive_subscription => true
+    exclusive_subscription => false
 }).
 
 -spec check_pub(

+ 1 - 1
apps/emqx/src/emqx_schema.erl

@@ -443,7 +443,7 @@ fields("mqtt") ->
             sc(
                 boolean(),
                 #{
-                    default => true,
+                    default => false,
                     desc => ?DESC(mqtt_exclusive_subscription)
                 }
             )},