fix influxdb

This commit is contained in:
anlicheng 2023-07-27 17:46:16 +08:00
parent 1e96ff8bbf
commit bb753146ac

View File

@ -140,18 +140,13 @@ handle_cast({write, Bucket, Org, Precision, Points}, State = #state{host = Host,
lager:debug("[influx_client] url is: ~p, headers: ~p, body: ~ts", [Url, Headers, Body]),
case hackney:request(post, Url, Headers, GZipBody, [{pool, influx_pool}]) of
{ok, StatusCode, _RespHeaders, ClientRef} ->
case StatusCode >= 200 andalso StatusCode < 300 of
true ->
case hackney:body(ClientRef) of
{ok, RespBody} ->
lager:debug("[influx_client] status_code: ~p, response body is: ~p", [StatusCode, RespBody]);
{error, Error} ->
lager:warning("[influx_client] response error is: ~p", [Error])
end;
false ->
lager:debug("[influx_client] status_code: ~p", [StatusCode]),
hackney:close(ClientRef)
end;
case hackney:body(ClientRef) of
{ok, RespBody} ->
lager:debug("[influx_client] status_code: ~p, response body is: ~p", [StatusCode, RespBody]);
{error, Error} ->
lager:warning("[influx_client] status_code: ~p, error is: ~p", [Error])
end,
hackney:close(ClientRef);
{error, Reason} ->
lager:warning("[influx_client] request result is: ~p", [Reason])
end,