C# MongoDB driver ignores timeout option

321 views
Skip to first unread message

Stanislav Radkov

unread,
Jul 18, 2014, 8:28:33 AM7/18/14
to mongod...@googlegroups.com
Hi,

We are using the C# (1.9.1) driver for Mongo DB. We have some fallback logic which needs to run if the DB is not accessible, however the default timeout it too long. We tried to change it but the values we put are getting ignored. For the tests we were using the IP of a non-responding machine.

We tried setting the timeout in the connection string:

<add key="Mongo" value="mongodb://xxx.xxx.xxx.xxx:27017/?socketTimeoutMS=2000&amp;connectTimeoutMS=2000&amp;waitqueuetimeoutms=2000"/>

   
Or via the code:

                 var client = new MongoClient(new MongoClientSettings
                    {
                        Server = new MongoServerAddress("xxx.xxx.xxx.xxx"),
                        SocketTimeout = new TimeSpan(0, 0, 0, 2),
                        WaitQueueTimeout = new TimeSpan(0, 0, 0, 2),
                        ConnectTimeout = new TimeSpan(0, 0, 0, 2)
                    });

Both time the requests timeout after an average of about 20 seconds.

Please advise what could be wrong in the way we are setting the timeout options.

Thanks


Thanks,
Stan

Stanislav Radkov

unread,
Jul 22, 2014, 3:51:52 AM7/22/14
to mongod...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages