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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe95b809af3e8ba3e7dcb35684df215cf3a366c5
4
- data.tar.gz: ad8d716fd8ec02ab0245dedffe098c1facb71a76
3
+ metadata.gz: 0527f897994e73459603aa98d9e837a488c049bb
4
+ data.tar.gz: f400bd0241ab6a512f4cb0b855534cc0eb964fe7
5
5
  SHA512:
6
- metadata.gz: 1d75ad7ba8d8127addba511ff259755c5b6bbcf94acdbe7fb05448fcf73848682c4bb93307ba0bb81cd3609a3aa58663f0304b1b9721cc90c002ecf37540ffa8
7
- data.tar.gz: 90bd44b093930aed15f0a77efe77a347d97ca181a40506a9c976f73e267f7e39199c01e9e09106e8f5acb5a36adb2122e9671f5c0905030308cf34a8a15bcc38
6
+ metadata.gz: 730d556f8c33c4c720eb7064db0fd61a79fffea1657b9e85e75d690793fe048c709974e0be0b82bb12d5b8a44aeef0ed4cab978efded2515930cfc0802e5348d
7
+ data.tar.gz: 989d1e898abe6234aecf57972f0cb6b8b85d5a6f37ea77a766921165f53d9b985e561715b35465eb4b1dfc748522b9b921f79dfbca3df7b522d6745b8ebac47f
@@ -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
@@ -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 :address, :down_at, :ip_address, :peers, :port, :resolved_address, :timeout, :options
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
- !@refreshed_at || @refreshed_at < time
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)
@@ -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["err"] || result["errmsg"] || result["$err"]
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
- result && (UNAUTHORIZED.include?(result["code"]) || UNAUTHORIZED.include?(result["assertionCode"]))
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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "1.4.4"
3
+ VERSION = "1.4.5"
4
4
  end
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
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-22 00:00:00.000000000 Z
11
+ date: 2013-03-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A MongoDB driver for Ruby.
14
14
  email: