Ruby Mongo驱动程序上超时和连接超时选项之间的差异

Ruby Mongo驱动程序上超时和连接超时选项之间的差异,ruby,mongodb,Ruby,Mongodb,当通过Ruby连接到Mongo时,我们需要设置一个超时值。我们在Mongo 2.2上 我们应该使用:timeout还是:connect\u timeout?我们在这里和其他地方看到使用这两个选项的代码片段。区别是什么?您可以在这里看到不同的超时: 从那里复制: # @option opts [Float] :timeout (5.0) When all of the self.connections a pool are checked out, # this is the numbe

当通过Ruby连接到Mongo时,我们需要设置一个超时值。我们在Mongo 2.2上


我们应该使用
:timeout
还是
:connect\u timeout
?我们在这里和其他地方看到使用这两个选项的代码片段。区别是什么?

您可以在这里看到不同的超时:

从那里复制:

#  @option opts [Float] :timeout (5.0) When all of the self.connections a pool are checked out,
#    this is the number of seconds to wait for a new connection to be released before throwing an exception.
#    Note: this setting is relevant only for multi-threaded applications.
#  @option opts [Float] :op_timeout (nil) The number of seconds to wait for a read operation to time out.
#    Disabled by default.
#  @option opts [Float] :connect_timeout (nil) The number of seconds to wait before timing out a
#    connection attempt.