Skip to content

Should Kredis::Types::Proxy#multi be fault tolerant? #153

Open
@BigBlue79

Description

@BigBlue79

We're working on storing some ephemeral, nice-to -have data in a Kredis.ordered_set. During a recent game day where we intentionally took down our redis instance, I was a little surprised to see that some of the Kredis operations were fault-tolerant, but some weren't.

It looks like the current implementation uses method_missing to delegate methods from OrderedSet (and others) to the underlying redis proxy, but redis.multi is not wrapped in the failsafe. As a result, in the event of a redis connection failure, commands that are straightforwardly delegated to the underlying redis do not raise errors, but the same commands that wrapped in redis.multi do raise an error.

Now there are varying degrees of fault-tolerance, depending on the method you choose

os = Kredis.ordered_set("testing")

os.elements
# => [] 

os.remove("something")
# => nil 

os.append("something")
# => Connection refused - connect(2) for 127.0.0.1:6379 (redis://localhost:6379) (Redis::CannotConnectError)

os.prepend("something")
# => Connection refused - connect(2) for 127.0.0.1:6379 (redis://localhost:6379) (Redis::CannotConnectError)

Is this the intended behaviour, or should Kredis operations be fault-tolerant by default?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions