moped 2.0.2 → 2.0.3

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: 31a5802e9db7f000e443ba32ba8fd09a8195dba5
4
- data.tar.gz: 7d783153a981ce891e3abc42fb55e74a19aadb06
3
+ metadata.gz: 4c42ef9279d08c76ecf69539b067b93ab0878f4e
4
+ data.tar.gz: 3a12fc6c37618f64b7554483f186bac840df90bb
5
5
  SHA512:
6
- metadata.gz: 575a7b7fbdf672db7b84a3c831022c54f3498689b387686e7961664ae1247f3d8fe9dc8c84b96527a7298d03ad70d70464fb769871d89a5e1685994bf365b60c
7
- data.tar.gz: 8a41a3ad6e0eab9d3ab5fb67673adec644fd1c6f0d43e01495d00ce63ef42afe48230ef287bc3eec84857800811cdf1db867750ac8123724c6b2106e4fcc62f0
6
+ metadata.gz: a636e60201e811f5ea5334ae6e2d3418e2c3c483ae992183172abadadf5ffa0b1682acbac4e03684e4d2dede020d3f562e3a512dbfe6395b19615746fc121707
7
+ data.tar.gz: b733ee7605f748665b060621b7a65bc1ee2ca610f6079ca96c76563329b9140f25468c618e96986abda5be9e963aa52881c6f3982f98d99c5245ae415170c428
@@ -1,12 +1,19 @@
1
1
  # Overview
2
2
 
3
+ ## 2.0.3
4
+
5
+ ### Resolved Issues
6
+
7
+ * \#333, \#336
8
+ Disconnect even when IP address not resolved and fix shutdown pool for node. (durran)
9
+
3
10
  ## 2.0.2
4
11
 
5
12
  ### Resolved Issues
6
13
 
7
14
  * Dont include peers if node already in the list
8
15
  There was a big memory leak, that was including all
9
- nodes in the list in every refresh cycle(Arthur Neves)
16
+ nodes in the list in every refresh cycle. (Arthur Neves)
10
17
 
11
18
  ## 2.0.1
12
19
 
data/README.md CHANGED
@@ -25,7 +25,7 @@ the Moped section: [mongoid.org](http://mongoid.org/en/moped/)
25
25
  License
26
26
  -------
27
27
 
28
- Copyright (c) 2011-2013 Bernerd Schaefer, Durran Jordan
28
+ Copyright (c) 2011-2014 Bernerd Schaefer, Durran Jordan
29
29
 
30
30
  Permission is hereby granted, free of charge, to any person obtaining
31
31
  a copy of this software and associated documentation files (the
@@ -46,6 +46,7 @@ module Moped
46
46
  # @since 2.0.0
47
47
  def resolve(node)
48
48
  begin
49
+ return @resolved if @resolved
49
50
  Timeout::timeout(@timeout) do
50
51
  Resolv.each_address(host) do |ip|
51
52
  if ip =~ Resolv::IPv4::Regex
@@ -55,7 +56,7 @@ module Moped
55
56
  end
56
57
  raise Resolv::ResolvError unless @ip
57
58
  end
58
- @resolved ||= "#{ip}:#{port}"
59
+ @resolved = "#{ip}:#{port}"
59
60
  rescue Timeout::Error, Resolv::ResolvError, SocketError
60
61
  Loggable.warn(" MOPED:", "Could not resolve IP for: #{original}", "n/a")
61
62
  node.down! and false
@@ -35,6 +35,26 @@ module Moped
35
35
  end
36
36
  end
37
37
 
38
+ # Shutdown the connection pool for the provided node. In the case of
39
+ # unresolved IP addresses the resolved address would be nil resulting in
40
+ # the same pool for all nodes that did not have IP resolved.
41
+ #
42
+ # @example Shut down the connection pool.
43
+ # Manager.shutdown(node)
44
+ #
45
+ # @param [ Node ] node The node.
46
+ #
47
+ # @return [ nil ] Always nil.
48
+ #
49
+ # @since 2.0.3
50
+ def shutdown(node)
51
+ MUTEX.synchronize do
52
+ pool = pools.delete(node.address.resolved)
53
+ pool.shutdown{ |conn| conn.disconnect } if pool
54
+ nil
55
+ end
56
+ end
57
+
38
58
  private
39
59
 
40
60
  # Create a new connection pool for the provided node.
@@ -137,7 +137,7 @@ module Moped
137
137
  #
138
138
  # @since 1.2.0
139
139
  def disconnect
140
- connection{ |conn| conn.disconnect } if address.resolved
140
+ connection{ |conn| conn.disconnect }
141
141
  true
142
142
  end
143
143
 
@@ -150,9 +150,10 @@ module Moped
150
150
  #
151
151
  # @since 2.0.0
152
152
  def down!
153
+ @pool = Connection::Manager.shutdown(self)
153
154
  @down_at = Time.new
154
155
  @latency = nil
155
- disconnect
156
+ true
156
157
  end
157
158
 
158
159
  # Yields the block if a connection can be established, retrying when a
@@ -185,7 +186,6 @@ module Moped
185
186
  ensure
186
187
  end_execution(:connection)
187
188
  end
188
-
189
189
  end
190
190
 
191
191
  # Set a flag on the node for the duration of provided block so that an
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "2.0.2"
3
+ VERSION = "2.0.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-18 00:00:00.000000000 Z
12
+ date: 2015-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson