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

fix(redis): unwrap pipeline queries against redis cluster

This is an additional safety measure in addition to the disabled
batching on the bridge level.
Andrew Mayorov 3 лет назад
Родитель
Сommit
2ee00b75a7
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      apps/emqx_connector/src/emqx_connector_redis.erl

+ 5 - 1
apps/emqx_connector/src/emqx_connector_redis.erl

@@ -222,6 +222,8 @@ is_unrecoverable_error(Results) when is_list(Results) ->
     lists:any(fun is_unrecoverable_error/1, Results);
 is_unrecoverable_error({error, <<"ERR unknown command ", _/binary>>}) ->
     true;
+is_unrecoverable_error({error, invalid_cluster_command}) ->
+    true;
 is_unrecoverable_error(_) ->
     false.
 
@@ -267,7 +269,9 @@ do_cmd(PoolName, cluster, {cmd, Command}) ->
 do_cmd(Conn, _Type, {cmd, Command}) ->
     eredis:q(Conn, Command);
 do_cmd(PoolName, cluster, {cmds, Commands}) ->
-    wrap_qp_result(eredis_cluster:qp(PoolName, Commands));
+    % TODO
+    % Cluster mode is currently incompatible with batching.
+    wrap_qp_result([eredis_cluster:q(PoolName, Command) || Command <- Commands]);
 do_cmd(Conn, _Type, {cmds, Commands}) ->
     wrap_qp_result(eredis:qp(Conn, Commands)).