On Mon, 12 Dec 2022 at 20:21, Michaël Catanzariti
<
michael.c...@gmail.com> wrote:
> Hi all,
<snip>
> I'm thinking about different options to let the user configure the library retry mechanism:
> No automatic retry at all
That would result in users having to implement retry themselves, which
might be annoying.
> Let the user provide, in the initial configuration of the connection, a list of command names which could be resent in case of error
Not flexible enough since specific commands cannot opt-out of the behaviour.
> Let the user provide, when sending a command, a contextual flag, to automatically resend this particular command execution in case of error.
That is the most flexible thing to do IMO.
> Expose a connection configuration to retry only read-only commands
> Expose a connection configuration to retry only idempotent commands
> Expose a connection configuration to retry all the commands
Also not flexible enough.
> These are my questions:
<snip>
> What are you thoughts about all these retry mechanisms ? Do you think some of them are useless or overkill ? Do you think some other mechanisms are missing ?
The approach I use in Aedis [1] is to offer flags per request, see
[2]. It covers all variants you describe above.
By the way, consider contributing to the benchmark of Redis clients
here [3]. The Rust implementation I use is based crate Redis [4].
[1]
https://github.com/mzimbres/aedis
[2]
https://mzimbres.github.io/aedis/classaedis_1_1resp3_1_1request.html#structaedis_1_1resp3_1_1request_1_1config
[3]
https://mzimbres.github.io/aedis/index.html#autotoc_md14
[4]
https://github.com/mzimbres/aedis/blob/master/benchmarks/rust/echo_server_over_redis/src/main.rs