You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Whether the error is a "not master" error, or one of its variants.
18
+
#
19
+
# See https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-master-and-node-is-recovering.
20
+
#
21
+
# @return [ true | false ] Whether the error is a not master.
22
+
#
23
+
# @since 2.8.0
24
+
defnot_master?
25
+
ifnode_recovering?
26
+
false
27
+
elsifcode && NOT_MASTER_CODES.include?(code)
28
+
true
29
+
elsifmessage
30
+
message.include?('not master')
31
+
else
32
+
false
33
+
end
34
+
end
35
+
36
+
# Whether the error is a "node is recovering" error, or one of its variants.
37
+
#
38
+
# See https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-master-and-node-is-recovering.
39
+
#
40
+
# @return [ true | false ] Whether the error is a node is recovering.
41
+
#
42
+
# @since 2.8.0
43
+
defnode_recovering?
44
+
ifcode && NODE_RECOVERING_CODES.include?(code)
45
+
true
46
+
elsifmessage
47
+
message.include?('node is recovering') || message.include?('not master or secondary')
0 commit comments