Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-25

Way to set operation timeout.

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.4
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS: Linux, 32 and 64 bit.

      Hello there,

      When doing MongoDB tests, I found out that if there is no response from MongoDB for some reason to a query, request get stuck there for the unknown timing.
      I am using MongoDB's 'C' driver to handle HTTP requests and here need is that user should get response within second( rather milliseconds).

      When HTTP request comes for any CRUD(create, insert, update, Delete) operation, there should be a way to specify a timeout period for a request, so that if there is any error like network issue etc. and request is taking more time than the req_timeout_period, then request should not get stuck there and should return error something like "MongoDB request timed out".

      It helps me to respond to HTTP request within desired time window. If HTTP request is just waiting for MongoDB to respond, web page @ the user (browser) will be in loading state for that much time. If this handled by the 'C' driver in appropriate way, then I will be able to respond to HTTP_Request in appropriate manner.

      The way I want it is something like this:

      set_req_timeout(int in_sec);
      OR
      set_req_timeout(int in_milli_sec);

      // operation request send to MongoDB
      TRY {
      send( operation, massage );
      }
      CATCH ( MongoDB_Req_TimeOut ) {
      cancel request to MongoDB; // so that this request wont keep trying for response anymore
      return MongoDB_Req_TimeOut;
      }

            Assignee:
            kbanker Kyle Banker
            Reporter:
            dilip Dilip Vaidya
            Votes:
            7 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: