mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-03 12:48:30 +08:00
fix: remove rand dgiot_http_client
This commit is contained in:
parent
9877b9c566
commit
56dd892557
@ -38,17 +38,11 @@ init([#{<<"channel">> := ChannelId, <<"client">> := ClientId, <<"mod">> := Mod}
|
||||
%% io:format("~s ~p Args ~p ~n", [?FILE, ?LINE, Args]),
|
||||
UserData = #connect_state{mod = Mod},
|
||||
ChildState = maps:get(<<"child">>, Args, #{}),
|
||||
StartTime = dgiot_client:get_time(maps:get(<<"starttime">>, Args, dgiot_datetime:now_secs())),
|
||||
EndTime = dgiot_client:get_time(maps:get(<<"endtime">>, Args, dgiot_datetime:now_secs() + 1000000000)),
|
||||
StartTime = dgiot_client:get_time(maps:get(<<"starttime">>, Args, dgiot_datetime:now_secs())),
|
||||
EndTime = dgiot_client:get_time(maps:get(<<"endtime">>, Args, dgiot_datetime:now_secs() + 1000000000)),
|
||||
Freq = maps:get(<<"freq">>, Args, 30),
|
||||
NextTime = dgiot_client:get_nexttime(StartTime, Freq),
|
||||
Count = dgiot_client:get_count(StartTime, EndTime, Freq),
|
||||
Rand =
|
||||
case maps:get(<<"rand">>, Args, true) of
|
||||
true -> 0;
|
||||
_ -> dgiot_client:get_rand(Freq)
|
||||
end,
|
||||
Clock = #dclock{freq = Freq, nexttime = NextTime + Rand, count = Count, round = 0},
|
||||
Clock = #dclock{freq = Freq, nexttime = StartTime, count = Count, round = 0},
|
||||
Dclient = #dclient{channel = ChannelId, client = ClientId, status = ?DCLIENT_INTIALIZED, clock = Clock, userdata = UserData, child = ChildState},
|
||||
dgiot_client:add(ChannelId, ClientId),
|
||||
case Mod:init(Dclient) of
|
||||
|
@ -57,7 +57,7 @@ start_link(Args) ->
|
||||
dgiot_client:start_link(?MODULE, Args).
|
||||
|
||||
init([#{<<"channel">> := ChannelId, <<"client">> := ClientId, <<"mod">> := Mod} = Args]) ->
|
||||
%% io:format("~s ~p Args ~p ~n", [?FILE, ?LINE, Args]),
|
||||
%% io:format("~s ~p Args ~p ~n", [?FILE, ?LINE, Args]),
|
||||
set_uri(dgiot_utils:to_binary(ChannelId), maps:with([<<"proctol">>, <<"host">>, <<"ip">>, <<"port">>], Args)),
|
||||
UserData = #connect_state{mod = Mod},
|
||||
ChildState = maps:get(<<"child">>, Args, #{}),
|
||||
|
Loading…
Reference in New Issue
Block a user