Explorar el Código

fix(emqx_resource_instance): improve the pattern match of the function call_health_check

EMQ-YangM hace 3 años
padre
commit
bb12378806
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      apps/emqx_resource/src/emqx_resource_instance.erl

+ 5 - 0
apps/emqx_resource/src/emqx_resource_instance.erl

@@ -295,6 +295,11 @@ do_health_check(Group, #{id := InstId, mod := Mod, state := ResourceState0} = Da
             ets:insert(emqx_resource_instance,
             ets:insert(emqx_resource_instance,
                 {InstId, Group, Data#{status => connected, state => ResourceState1}}),
                 {InstId, Group, Data#{status => connected, state => ResourceState1}}),
             ok;
             ok;
+        {error, Reason} ->
+            logger:error("health check for ~p failed: ~p", [InstId, Reason]),
+            ets:insert(emqx_resource_instance,
+                {InstId, Group, Data#{status => connecting}}),
+            {error, Reason};
         {error, Reason, ResourceState1} ->
         {error, Reason, ResourceState1} ->
             logger:error("health check for ~p failed: ~p", [InstId, Reason]),
             logger:error("health check for ~p failed: ~p", [InstId, Reason]),
             ets:insert(emqx_resource_instance,
             ets:insert(emqx_resource_instance,