fix(bridge): time unit error for MQTT keepalive

This commit is contained in:
Shawn 2021-12-28 14:12:28 +08:00
parent eb992ad2ad
commit 4406589980
1 changed files with 4 additions and 1 deletions

View File

@ -208,7 +208,7 @@ basic_config(#{
username => User, username => User,
password => Password, password => Password,
clean_start => CleanStart, clean_start => CleanStart,
keepalive => KeepAlive, keepalive => ms_to_s(KeepAlive),
retry_interval => RetryIntv, retry_interval => RetryIntv,
max_inflight => MaxInflight, max_inflight => MaxInflight,
ssl => EnableSsl, ssl => EnableSsl,
@ -216,5 +216,8 @@ basic_config(#{
if_record_metrics => true if_record_metrics => true
}. }.
ms_to_s(Ms) ->
erlang:ceil(Ms / 1000).
clientid(Id) -> clientid(Id) ->
iolist_to_binary([Id, ":", atom_to_list(node())]). iolist_to_binary([Id, ":", atom_to_list(node())]).