[CSHARP-1285] Is there a way to set a timout for CRUD? Or just Query Select? Created: 18/May/15  Updated: 05/Apr/19  Resolved: 17/Jun/15

Status: Closed
Project: C# Driver
Component/s: API, Operations
Affects Version/s: 2.0
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: blk001 Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

win7 64bit,vs2012



 Description   

Thanks for your reading.
Such as title.

Is there a way to set a timout for CRUD? Or just Query Select?
I set all the timeout in MongoServerSetting class cause I want a timout when
CRUD operations too long to take so many memory.
And I also try to use SetMaxTime() to findas a Tdocument,Then I set timeSpan in 10ms,It worked.But when timeSpan greater than 20ms,didn't worked.
If I don't like to set webrequestion timeout ,How to set timeout?



 Comments   
Comment by Craig Wilson [ 22/May/15 ]

Hi blk001,

How long do your queries take? Are all your servers available?

SetMaxTime only applies to to portion executed by the server. As it sounds like you are using the legacy API (by your reference to MongoServerSettings), there is not way to set an overall timeout for the client. We also have another setting coming in 2.1 called ServerSelectionTimeout which applies to a certain portion of the client-side work dealing with selecting a server.

Craig

Generated at Wed Feb 07 21:39:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.