~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/mongo/open.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
        "github.com/juju/juju/cert"
20
20
)
21
21
 
22
 
// SocketTimeout should be long enough that
23
 
// even a slow mongo server will respond in that
24
 
// length of time. Since mongo servers ping themselves
25
 
// every 10 seconds, we use a value of just over 2
26
 
// ping periods to allow for delayed pings due to
27
 
// issues such as CPU starvation etc.
28
 
const SocketTimeout = 21 * time.Second
 
22
// SocketTimeout should be long enough that even a slow mongo server
 
23
// will respond in that length of time, and must also be long enough
 
24
// to allow for completion of heavyweight queries.
 
25
//
 
26
// Note: 1 minute is mgo's default socket timeout value.
 
27
//
 
28
// Also note: We have observed mongodb occasionally getting "stuck"
 
29
// for over 30s in the field.
 
30
const SocketTimeout = time.Minute
29
31
 
30
 
// defaultDialTimeout should be representative of
31
 
// the upper bound of time taken to dial a mongo
32
 
// server from within the same cloud/private network.
 
32
// defaultDialTimeout should be representative of the upper bound of
 
33
// time taken to dial a mongo server from within the same
 
34
// cloud/private network.
33
35
const defaultDialTimeout = 30 * time.Second
34
36
 
35
37
// DialOpts holds configuration parameters that control the