Просмотр исходного кода

Merge pull request #991 from emqtt/develop

Support HEAD method for health check
turtleDeng 9 лет назад
Родитель
Сommit
6f02d775e4
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      src/emqttd_bridge.erl
  2. 1 1
      src/emqttd_http.erl

+ 2 - 2
src/emqttd_bridge.erl

@@ -37,7 +37,7 @@
 
 -record(state, {pool, id,
                 node, subtopic,
-                qos                = ?QOS_2,
+                qos                = ?QOS_0,
                 topic_suffix       = <<>>,
                 topic_prefix       = <<>>,
                 mqueue             :: emqttd_mqueue:mqueue(),
@@ -74,7 +74,7 @@ init([Pool, Id, Node, Topic, Options]) ->
         true -> 
             true = erlang:monitor_node(Node, true),
             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}),
             MQueue = emqttd_mqueue:new(qname(Node, Topic),
                                        [{max_len, State#state.max_queue_len}],

+ 1 - 1
src/emqttd_http.erl

@@ -31,7 +31,7 @@
 handle_request(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(),
     AppStatus =
     case lists:keysearch(emqttd, 1, application:which_applications()) of