liubiao4123 / servicestack

Automatically exported from code.google.com/p/servicestack
0 stars 0 forks source link

Db number is fogotten when using pooled clients. #76

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

    var pool = new PooledRedisClientManager(0, new string[] { "localhost" });
    var loops = 2;

    while (loops-- >= 0)
    {
        using (var client = pool.GetClient())
        {
            client.Db = 1;
            (client as IRedisNativeClient).Ping();
            client.GetAllItemsFromSortedSet("SomeKey").Dump();
        }
    }

What is the expected output? What do you see instead?

All commands should be issued under the same db number (1). But instead, only 
the first iteration selects 1 as db, the remaining iterations are querying 
against db 0.

This is the output of redis in monitor mode:

1385468302.557112 [0 192.168.186.1:17775] "SELECT" "1"
1385468302.558593 [1 192.168.186.1:17775] "PING"
1385468302.559663 [1 192.168.186.1:17775] "ZRANGE" "SomeKey" "0" "-1"
1385468302.624003 [1 192.168.186.1:17775] "SELECT" "0"
1385468302.624339 [0 192.168.186.1:17775] "PING"
1385468302.624692 [0 192.168.186.1:17775] "ZRANGE" "SomeKey" "0" "-1"
1385468302.625269 [0 192.168.186.1:17775] "SELECT" "0"
1385468302.625426 [0 192.168.186.1:17775] "PING"
1385468302.625678 [0 192.168.186.1:17775] "ZRANGE" "SomeKey" "0" "-1"

What version of the product are you using? On what operating system?

3.9.69.0

Original issue reported on code.google.com by pablo.r...@gmail.com on 26 Nov 2013 at 12:27