mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-12 12:16:01 +08:00
fix: remove rand dgiot_http_client
This commit is contained in:
parent
9877b9c566
commit
56dd892557
@ -41,14 +41,8 @@ init([#{<<"channel">> := ChannelId, <<"client">> := ClientId, <<"mod">> := Mod}
|
|||||||
StartTime = dgiot_client:get_time(maps:get(<<"starttime">>, Args, dgiot_datetime:now_secs())),
|
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)),
|
EndTime = dgiot_client:get_time(maps:get(<<"endtime">>, Args, dgiot_datetime:now_secs() + 1000000000)),
|
||||||
Freq = maps:get(<<"freq">>, Args, 30),
|
Freq = maps:get(<<"freq">>, Args, 30),
|
||||||
NextTime = dgiot_client:get_nexttime(StartTime, Freq),
|
|
||||||
Count = dgiot_client:get_count(StartTime, EndTime, Freq),
|
Count = dgiot_client:get_count(StartTime, EndTime, Freq),
|
||||||
Rand =
|
Clock = #dclock{freq = Freq, nexttime = StartTime, count = Count, round = 0},
|
||||||
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},
|
|
||||||
Dclient = #dclient{channel = ChannelId, client = ClientId, status = ?DCLIENT_INTIALIZED, clock = Clock, userdata = UserData, child = ChildState},
|
Dclient = #dclient{channel = ChannelId, client = ClientId, status = ?DCLIENT_INTIALIZED, clock = Clock, userdata = UserData, child = ChildState},
|
||||||
dgiot_client:add(ChannelId, ClientId),
|
dgiot_client:add(ChannelId, ClientId),
|
||||||
case Mod:init(Dclient) of
|
case Mod:init(Dclient) of
|
||||||
|
Loading…
Reference in New Issue
Block a user