@@ -18,6 +18,8 @@ defmodule Mongo.Topology do
18
18
# https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#heartbeatfrequencyms-defaults-to-10-seconds-or-60-seconds
19
19
@ heartbeat_frequency_ms 10_000
20
20
21
+ @ default_checkout_timeout 60_000
22
+
21
23
@ spec start_link ( Keyword . t , Keyword . t ) ::
22
24
{ :ok , pid } |
23
25
{ :error , reason :: atom }
@@ -51,8 +53,9 @@ defmodule Mongo.Topology do
51
53
GenServer . call ( pid , :topology )
52
54
end
53
55
54
- def select_server ( pid , type , opts \\ [ ] ) do
55
- GenServer . call ( pid , { :select_server , type , opts } )
56
+ def select_server ( pid , type , opts \\ [ ] ) do #97
57
+ timeout = Keyword . get ( opts , :checkout_timeout , @ default_checkout_timeout )
58
+ GenServer . call ( pid , { :select_server , type , opts } , timeout )
56
59
end
57
60
58
61
def limits ( pid ) do
@@ -63,11 +66,9 @@ defmodule Mongo.Topology do
63
66
GenServer . call ( pid , :wire_version )
64
67
end
65
68
66
- @ doc """
67
-
68
- """
69
69
def checkout_session ( pid , cmd_type , type , opts \\ [ ] ) do
70
- GenServer . call ( pid , { :checkout_session , cmd_type , type , opts } )
70
+ timeout = Keyword . get ( opts , :checkout_timeout , @ default_checkout_timeout )
71
+ GenServer . call ( pid , { :checkout_session , cmd_type , type , opts } , timeout )
71
72
end
72
73
73
74
def checkin_session ( pid , server_session ) do
0 commit comments