fix(redis): unwrap pipeline queries against redis cluster

This is an additional safety measure in addition to the disabled
batching on the bridge level.
This commit is contained in:
Andrew Mayorov 2023-01-25 16:49:55 +03:00
parent 26fcaecad7
commit 2ee00b75a7
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 5 additions and 1 deletions

View File

@ -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)).