Merge pull request #991 from emqtt/develop
Support HEAD method for health check
This commit is contained in:
commit
6f02d775e4
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
-record(state, {pool, id,
|
-record(state, {pool, id,
|
||||||
node, subtopic,
|
node, subtopic,
|
||||||
qos = ?QOS_2,
|
qos = ?QOS_0,
|
||||||
topic_suffix = <<>>,
|
topic_suffix = <<>>,
|
||||||
topic_prefix = <<>>,
|
topic_prefix = <<>>,
|
||||||
mqueue :: emqttd_mqueue:mqueue(),
|
mqueue :: emqttd_mqueue:mqueue(),
|
||||||
|
@ -74,7 +74,7 @@ init([Pool, Id, Node, Topic, Options]) ->
|
||||||
true ->
|
true ->
|
||||||
true = erlang:monitor_node(Node, true),
|
true = erlang:monitor_node(Node, true),
|
||||||
Share = iolist_to_binary(["$bridge:", atom_to_list(Node), ":", Topic]),
|
Share = iolist_to_binary(["$bridge:", atom_to_list(Node), ":", Topic]),
|
||||||
emqttd:subscribe(Topic, self(), [local, {share, Share}]),
|
emqttd:subscribe(Topic, self(), [local, {share, Share}, {qos, ?QOS_0}]),
|
||||||
State = parse_opts(Options, #state{node = Node, subtopic = Topic}),
|
State = parse_opts(Options, #state{node = Node, subtopic = Topic}),
|
||||||
MQueue = emqttd_mqueue:new(qname(Node, Topic),
|
MQueue = emqttd_mqueue:new(qname(Node, Topic),
|
||||||
[{max_len, State#state.max_queue_len}],
|
[{max_len, State#state.max_queue_len}],
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
handle_request(Req) ->
|
handle_request(Req) ->
|
||||||
handle_request(Req:get(method), Req:get(path), Req).
|
handle_request(Req:get(method), Req:get(path), Req).
|
||||||
|
|
||||||
handle_request('GET', "/status", Req) ->
|
handle_request(Method, "/status", Req) when Method =:= 'HEAD'; Method =:= 'GET' ->
|
||||||
{InternalStatus, _ProvidedStatus} = init:get_status(),
|
{InternalStatus, _ProvidedStatus} = init:get_status(),
|
||||||
AppStatus =
|
AppStatus =
|
||||||
case lists:keysearch(emqttd, 1, application:which_applications()) of
|
case lists:keysearch(emqttd, 1, application:which_applications()) of
|
||||||
|
|
Loading…
Reference in New Issue