Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1025

"fail fast" client option

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.0.1
    • Component/s: Connections
    • Labels:
      None
    • Environment:
      Linux
      MongoDB 4.0

      Hello

      I'm migrating my code from globalsign/mgo to the official mongo driver.

      In my tests, I was using the "FailFast" optionĀ https://godoc.org/github.com/globalsign/mgo#DialInfo.FailFast

      It allows to connect to a MongoDB server with a "normal" timeout (e.g. 10 sec), however it will return an error after the first failed attempt.

      This is very useful in tests, because I want to skip my test if my local instance of MongoDB is not available.

      With mgo, all my tests were skipped very quickly, because the connection attempt returned an error immediately, and wasn't retried.

      However, in the mongo official driver, there is no such option. I can only define a very low "connect timeout" (e.g. 100 ms). This solution is not ideal, because on some busy CI server it could take longer to connect to MongoDB. This will cause "flaky" tests.

            Assignee:
            Unassigned Unassigned
            Reporter:
            pierrre Pierre Durand
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: