Skip to content

Using IDatabase.Execute or IDatabase.ExecuteAsync causes to next command run after a 'SELECT 0' #2845

@atakavci

Description

@atakavci

each time an IDatabase.ExecuteAsync or IDatabase.Execute s called, the next command executes after a SELECT 0 is sent.

        var db = ConnectionMultiplexer.Connect("localhost:6379").GetDatabase();

        db.StringSet("key1", "abc");
        db.StringSet("key2", "abc");

        await db.ExecuteAsync("set", "explicitCall1", "abc");

        db.StringSet("key3", "abc");
        db.StringSet("key4", "abc");

        db.Execute("set", "explicitCall2", "abc");

        db.StringSet("key5", "abc");
        db.StringSet("key6", "abc");

output from MONITOR command;

1738053208.322367 [0 192.168.48.1:55570] "SET" "key1" "abc"
1738053208.323767 [0 192.168.48.1:55570] "SET" "key2" "abc"
1738053208.328989 [0 192.168.48.1:55570] "SET" "explicitCall1" "abc"
1738053208.336072 [0 192.168.48.1:55570] "SELECT" "0"
1738053208.336110 [0 192.168.48.1:55570] "SET" "key3" "abc"
1738053208.336622 [0 192.168.48.1:55570] "SET" "key4" "abc"
1738053208.338578 [0 192.168.48.1:55570] "SET" "explicitCall2" "abc"
1738053208.339415 [0 192.168.48.1:55570] "SELECT" "0"
1738053208.339426 [0 192.168.48.1:55570] "SET" "key5" "abc"
1738053208.339852 [0 192.168.48.1:55570] "SET" "key6" "abc"

only way i can find to avoid ths seems to disable the SELECT command, which is not suitable for all cases.

this is caused due to the type of command Message is UNKNOWN when Execute or ExecuteAsync
here 👇

connection.SetUnknownDatabase();

How about making it optional to set it as unknown every time, or introduce an option command type CUSTOM , i am happy to come up with a PR.

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