Skip to content
Permalink
Browse files
optimize code & del unused code
  • Loading branch information
DLive committed Aug 1, 2019
1 parent 4c19f0b commit e91b05ee079439306f7d1d27f14d027a61bd9ce5
Showing 5 changed files with 2 additions and 30 deletions.
@@ -31,7 +31,7 @@ invoke(#dubbo_rpc_invocation{className = Interface, loadbalance = LoadBalance} =
%% case dubbo_traffic_control:check_goon(HostFlag, 199) of
%% ok ->
%%
%%%% Request2 = merge_attachments(Request, RpcContext), %% @todo need add rpc context to attachment

%%
%%%% {ok, RequestData} = dubbo_codec:encode_request(Request2),
%%%% Ref = get_ref(RequestState),
@@ -27,8 +27,5 @@ connect(ProviderConfig, Handler) ->
logger:info("start provider ~p pid info ~p~n", [HostFlag, Pid]),
{ok, #connection_info{pid = Pid, weight = get_weight(ProviderConfig), host_flag = HostFlag}}.



get_weight(_ProviderConfig) ->
%% todo get weight from provider info
30.
100.
@@ -40,11 +40,7 @@ create_proxy(ConsumerInfo) ->
ok = dubbo_extension:run_fold(protocol_wapper, refer, [Url], ok),
ok.

%%application=hello-world&dubbo=2.0.2&pid=68901&refer=application=hello-world&default.check=false&default.lazy=false&default.retries=0&default.sticky=false&default.timeout=300000&dubbo=2.0.2&interface=org.apache.dubbo.erlang.sample.service.facade.UserOperator&lazy=false&methods=queryUserInfo,queryUserList,genUserId,getUserInfo&pid=68901&register.ip=127.0.0.1&release=2.7.1&retries=0&side=consumer&sticky=false&timestamp=1559727789953&registry=zookeeper&release=2.7.1&timestamp=1559727842451


gen_registry_url(Para) ->
%%todo 组装para & url
{Host, Port} = dubbo_registry:get_registry_host_port(),
UrlInfo = #dubbo_url{
scheme = <<"registry">>,
@@ -54,9 +50,6 @@ gen_registry_url(Para) ->
parameters = Para
},
dubbo_common_fun:url_to_binary(UrlInfo).
%% Url = "registry://127.0.0.1:2181/org.apache.dubbo.registry.RegistryService?application=hello-world&dubbo=2.0.2&pid=68901&refer=application%3Dhello-world%26default.check%3Dfalse%26default.lazy%3Dfalse%26default.retries%3D0%26default.sticky%3Dfalse%26default.timeout%3D300000%26dubbo%3D2.0.2%26interface%3Dorg.apache.dubbo.erlang.sample.service.facade.UserOperator%26lazy%3Dfalse%26methods%3DqueryUserInfo%2CqueryUserList%2CgenUserId%2CgetUserInfo%26pid%3D68901%26register.ip%3D127.0.0.1%26release%3D2.7.1%26retries%3D0%26side%3Dconsumer%26sticky%3Dfalse%26timestamp%3D1559727789953&registry=zookeeper&release=2.7.1&timestamp=1559727842451",
%% Url.


gen_parameter(ConsumerInfo) ->
Para = #{
@@ -235,7 +235,6 @@ subscribe(SubcribeUrl, NotifyFun) ->
ok
catch
_Error:Reason ->
%%todo improve error type
{error, Reason}
end.

@@ -255,20 +254,6 @@ connection() ->
{monitor, self()}]),
{ok, Pid}.

add_consumer(InterfaceName, ConsumerUrl, State) ->
Pid = State#state.zk_pid,
ConsumerNode2 = list_to_binary(edoc_lib:escape_uri(binary_to_list(ConsumerUrl))),
check_and_create_path(Pid, <<"">>, [{<<"dubbo">>, p}, {InterfaceName, p}, {<<"consumers">>, p}, {ConsumerNode2, e}]),
%% todo
%% get_provider_list(Consumer, State),
ok.
register_provider_path(Provider, State) ->
#state{zk_pid = Pid} = State,
ProviderNode = dubbo_node_config_util:gen_provider_info(Provider),
check_and_create_path(Pid, <<"">>, [{<<"dubbo">>, p}, {Provider#provider_config.interface, p}, {<<"providers">>, p}, {ProviderNode, e}]),
ok.


get_provider_list(InterfaceName, ZkPid) ->
InterfacePath = <<<<"/dubbo/">>/binary, InterfaceName/binary, <<"/providers">>/binary>>,
ChildList = get_provider_and_start(ZkPid, InterfaceName, InterfacePath),
@@ -41,10 +41,7 @@ start_link() ->
%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
init([]) ->
dubboerl_app:env_init(),
%% @todo registry need move registry sup
%% ZK = {dubbo_registry_zookeeper, {dubbo_registry_zookeeper, start_link, []}, transient, 5000, worker, [dubbo_registry_zookeeper]},
RegistrySup = {dubbo_registry_sup, {dubbo_registry_sup, start_link, []}, transient, 5000, supervisor, [dubbo_registry_sup]},

ExtensionSer = {dubbo_extension, {dubbo_extension, start_link, []}, transient, 5000, worker, [dubbo_extension]},
Id_count = {dubbo_id_generator, {dubbo_id_generator, start_link, []}, transient, 5000, worker, [dubbo_id_generator]},
ProviderPoolSup = {dubbo_provider_worker_sup, {dubbo_provider_worker_sup, start_link, []}, transient, 5000, supervisor, [dubbo_provider_worker_sup]},

0 comments on commit e91b05e

Please sign in to comment.