fix: device state

This commit is contained in:
dawnwinterLiu 2023-04-19 15:59:59 +08:00
parent 59c1516f40
commit dbedd578a7
3 changed files with 9 additions and 3 deletions

View File

@ -42,7 +42,7 @@ parse_cache_Device(_ClassName) ->
end,
Query = #{
<<"order">> => <<"updatedAt">>,
<<"keys">> => [<<"ACL">>, <<"updatedAt">>, <<"devaddr">>, <<"status">>, <<"isEnable">>, <<"profile">>, <<"product">>, <<"location">>, <<"deviceSecret">>],
<<"keys">> => [<<"ACL">>, <<"updatedAt">>, <<"state">>, <<"devaddr">>, <<"status">>, <<"isEnable">>, <<"profile">>, <<"product">>, <<"location">>, <<"deviceSecret">>],
<<"where">> => #{}
},
dgiot_parse_loader:start(<<"Device">>, Query, 0, 100, 1000000, Success).

View File

@ -227,7 +227,13 @@ handle_message({data, Product, DevAddr, Data, Context}, #state{id = ChannelId} =
%%
handle_message({sql, Sql}, #state{id = ChannelId} = State) ->
dgiot_metrics:inc(dgiot_tdengine, <<"tdengine_recv">>, 1),
dgiot_tdengine:batch_sql(ChannelId, Sql),
case catch dgiot_tdengine:batch_sql(ChannelId, Sql) of
{Err, Reason} when Err == error; Err == 'EXIT' ->
dgiot_bridge:send_log(ChannelId, "Save to Tdengine error, ~p, ~p", [Sql, Reason]),
ok;
_ ->
pass
end,
{ok, State};
%%

@ -1 +1 @@
Subproject commit 9303052c9aee6e4f9cc38249a1e800e686c4c775
Subproject commit 2ace04bea5a1e77fee19bbe189a76e40f55c862f