fix(authz): fix deadlock issues
This commit is contained in:
parent
25b7719db5
commit
80c1128b7a
|
@ -48,12 +48,12 @@ init(#{url := Url} = Source) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
destroy(#{annotations := #{id := Id}}) ->
|
destroy(#{annotations := #{id := Id}}) ->
|
||||||
ok = emqx_resource:remove(Id).
|
ok = emqx_resource:remove_local(Id).
|
||||||
|
|
||||||
dry_run(Source) ->
|
dry_run(Source) ->
|
||||||
URIMap = maps:get(url, Source),
|
URIMap = maps:get(url, Source),
|
||||||
NSource = maps:put(base_url, maps:remove(query, URIMap), Source),
|
NSource = maps:put(base_url, maps:remove(query, URIMap), Source),
|
||||||
emqx_resource:create_dry_run(emqx_connector_http, NSource).
|
emqx_resource:create_dry_run_local(emqx_connector_http, NSource).
|
||||||
|
|
||||||
authorize(Client, PubSub, Topic,
|
authorize(Client, PubSub, Topic,
|
||||||
#{type := http,
|
#{type := http,
|
||||||
|
|
|
@ -46,10 +46,10 @@ init(Source) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
dry_run(Source) ->
|
dry_run(Source) ->
|
||||||
emqx_resource:create_dry_run(emqx_connector_mongo, Source).
|
emqx_resource:create_dry_run_local(emqx_connector_mongo, Source).
|
||||||
|
|
||||||
destroy(#{annotations := #{id := Id}}) ->
|
destroy(#{annotations := #{id := Id}}) ->
|
||||||
ok = emqx_resource:remove(Id).
|
ok = emqx_resource:remove_local(Id).
|
||||||
|
|
||||||
authorize(Client, PubSub, Topic,
|
authorize(Client, PubSub, Topic,
|
||||||
#{collection := Collection,
|
#{collection := Collection,
|
||||||
|
|
|
@ -48,10 +48,10 @@ init(#{query := SQL} = Source) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
dry_run(Source) ->
|
dry_run(Source) ->
|
||||||
emqx_resource:create_dry_run(emqx_connector_mysql, Source).
|
emqx_resource:create_dry_run_local(emqx_connector_mysql, Source).
|
||||||
|
|
||||||
destroy(#{annotations := #{id := Id}}) ->
|
destroy(#{annotations := #{id := Id}}) ->
|
||||||
ok = emqx_resource:remove(Id).
|
ok = emqx_resource:remove_local(Id).
|
||||||
|
|
||||||
authorize(Client, PubSub, Topic,
|
authorize(Client, PubSub, Topic,
|
||||||
#{annotations := #{id := ResourceID,
|
#{annotations := #{id := ResourceID,
|
||||||
|
|
|
@ -48,10 +48,10 @@ init(#{query := SQL} = Source) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
destroy(#{annotations := #{id := Id}}) ->
|
destroy(#{annotations := #{id := Id}}) ->
|
||||||
ok = emqx_resource:remove(Id).
|
ok = emqx_resource:remove_local(Id).
|
||||||
|
|
||||||
dry_run(Source) ->
|
dry_run(Source) ->
|
||||||
emqx_resource:create_dry_run(emqx_connector_pgsql, Source).
|
emqx_resource:create_dry_run_local(emqx_connector_pgsql, Source).
|
||||||
|
|
||||||
parse_query(Sql) ->
|
parse_query(Sql) ->
|
||||||
case re:run(Sql, ?RE_PLACEHOLDER, [global, {capture, all, list}]) of
|
case re:run(Sql, ?RE_PLACEHOLDER, [global, {capture, all, list}]) of
|
||||||
|
|
|
@ -46,10 +46,10 @@ init(Source) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
destroy(#{annotations := #{id := Id}}) ->
|
destroy(#{annotations := #{id := Id}}) ->
|
||||||
ok = emqx_resource:remove(Id).
|
ok = emqx_resource:remove_local(Id).
|
||||||
|
|
||||||
dry_run(Source) ->
|
dry_run(Source) ->
|
||||||
emqx_resource:create_dry_run(emqx_connector_redis, Source).
|
emqx_resource:create_dry_run_local(emqx_connector_redis, Source).
|
||||||
|
|
||||||
authorize(Client, PubSub, Topic,
|
authorize(Client, PubSub, Topic,
|
||||||
#{cmd := CMD,
|
#{cmd := CMD,
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
create_resource(Module, Config) ->
|
create_resource(Module, Config) ->
|
||||||
ResourceID = make_resource_id(Module),
|
ResourceID = make_resource_id(Module),
|
||||||
case emqx_resource:create(ResourceID, Module, Config) of
|
case emqx_resource:create_local(ResourceID, Module, Config) of
|
||||||
{ok, already_created} -> {ok, ResourceID};
|
{ok, already_created} -> {ok, ResourceID};
|
||||||
{ok, _} -> {ok, ResourceID};
|
{ok, _} -> {ok, ResourceID};
|
||||||
{error, Reason} -> {error, Reason}
|
{error, Reason} -> {error, Reason}
|
||||||
|
@ -40,7 +40,7 @@ create_resource(Module, Config) ->
|
||||||
|
|
||||||
cleanup_resources() ->
|
cleanup_resources() ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun emqx_resource:remove/1,
|
fun emqx_resource:remove_local/1,
|
||||||
emqx_resource:list_group_instances(?RESOURCE_GROUP)).
|
emqx_resource:list_group_instances(?RESOURCE_GROUP)).
|
||||||
|
|
||||||
make_resource_id(Name) ->
|
make_resource_id(Name) ->
|
||||||
|
|
Loading…
Reference in New Issue