moped 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of moped might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/moped/node.rb +12 -3
- data/lib/moped/protocol/reply.rb +10 -4
- data/lib/moped/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0527f897994e73459603aa98d9e837a488c049bb
|
4
|
+
data.tar.gz: f400bd0241ab6a512f4cb0b855534cc0eb964fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 730d556f8c33c4c720eb7064db0fd61a79fffea1657b9e85e75d690793fe048c709974e0be0b82bb12d5b8a44aeef0ed4cab978efded2515930cfc0802e5348d
|
7
|
+
data.tar.gz: 989d1e898abe6234aecf57972f0cb6b8b85d5a6f37ea77a766921165f53d9b985e561715b35465eb4b1dfc748522b9b921f79dfbca3df7b522d6745b8ebac47f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Overview
|
2
2
|
|
3
|
+
## 1.4.5
|
4
|
+
|
5
|
+
### Resolved Issues
|
6
|
+
|
7
|
+
* \#174 Check for "unauthorized" in error messages since codes are not always
|
8
|
+
there. (Jon Hyman)
|
9
|
+
|
10
|
+
* \#173 Ensure node `refreshed_at` is set even if the node is down, so down nodes
|
11
|
+
don't get hit on every query.
|
12
|
+
|
3
13
|
## 1.4.4
|
4
14
|
|
5
15
|
### Resolved Issues
|
data/lib/moped/node.rb
CHANGED
@@ -13,7 +13,16 @@ module Moped
|
|
13
13
|
# @attribute [r] resolved_address The host/port pair.
|
14
14
|
# @attribute [r] timeout The connection timeout.
|
15
15
|
# @attribute [r] options Additional options for the node (ssl).
|
16
|
-
attr_reader
|
16
|
+
attr_reader \
|
17
|
+
:address,
|
18
|
+
:down_at,
|
19
|
+
:ip_address,
|
20
|
+
:peers,
|
21
|
+
:port,
|
22
|
+
:resolved_address,
|
23
|
+
:timeout,
|
24
|
+
:options,
|
25
|
+
:refreshed_at
|
17
26
|
|
18
27
|
# Is this node equal to another?
|
19
28
|
#
|
@@ -269,7 +278,7 @@ module Moped
|
|
269
278
|
#
|
270
279
|
# @since 1.0.0
|
271
280
|
def needs_refresh?(time)
|
272
|
-
|
281
|
+
!refreshed_at || refreshed_at < time
|
273
282
|
end
|
274
283
|
|
275
284
|
# Execute a pipeline of commands, for example a safe mode persist.
|
@@ -382,8 +391,8 @@ module Moped
|
|
382
391
|
def refresh
|
383
392
|
if resolve_address
|
384
393
|
begin
|
385
|
-
info = command("admin", ismaster: 1)
|
386
394
|
@refreshed_at = Time.now
|
395
|
+
info = command("admin", ismaster: 1)
|
387
396
|
primary = true if info["ismaster"]
|
388
397
|
secondary = true if info["secondary"]
|
389
398
|
generate_peers(info)
|
data/lib/moped/protocol/reply.rb
CHANGED
@@ -68,7 +68,7 @@ module Moped
|
|
68
68
|
# @since 1.2.10
|
69
69
|
def command_failure?
|
70
70
|
result = documents[0]
|
71
|
-
result["ok"] != 1 || result
|
71
|
+
result["ok"] != 1 || error_message(result)
|
72
72
|
end
|
73
73
|
|
74
74
|
# Was the provided cursor id not found on the server?
|
@@ -110,7 +110,11 @@ module Moped
|
|
110
110
|
# @since 1.2.10
|
111
111
|
def unauthorized?
|
112
112
|
result = documents[0]
|
113
|
-
|
113
|
+
return false if result.nil?
|
114
|
+
err = error_message(result)
|
115
|
+
UNAUTHORIZED.include?(result["code"]) ||
|
116
|
+
UNAUTHORIZED.include?(result["assertionCode"]) ||
|
117
|
+
(err && err =~ /unauthorized/)
|
114
118
|
end
|
115
119
|
|
116
120
|
class << self
|
@@ -139,14 +143,16 @@ module Moped
|
|
139
143
|
|
140
144
|
def deserialize_documents(buffer)
|
141
145
|
documents = []
|
142
|
-
|
143
146
|
count.times do
|
144
147
|
documents << BSON::Document.deserialize(buffer)
|
145
148
|
end
|
146
|
-
|
147
149
|
@documents = documents
|
148
150
|
end
|
149
151
|
|
152
|
+
def error_message(result)
|
153
|
+
result["err"] || result["errmsg"] || result["$err"]
|
154
|
+
end
|
155
|
+
|
150
156
|
end
|
151
157
|
end
|
152
158
|
end
|
data/lib/moped/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moped
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernerd Schaefer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A MongoDB driver for Ruby.
|
14
14
|
email:
|