multithink 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7bb778470457bc6f85a1a33acd0382bb13ef0b68
4
- data.tar.gz: 1489fc8c89e31547d11eaf7705b900d745fde4c5
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTVkZmE4MTA0MTQxMTUzYzQ1YmQ0ZDFjMWYxZTZkYjU2OWM5Njc5MQ==
5
+ data.tar.gz: !binary |-
6
+ ZDFjY2U1NzlhMTdiYjZiMjQxYmU1ZDI3YjM4ZGQzMTE2MDMzZGJmMA==
5
7
  SHA512:
6
- metadata.gz: d914ef40c36e8db39b141e05755e61dfc40363a01163c7ad623fc6cf1d257b3184e3f746d5c6da0fc0231ceaaba3e1f7dbbdc787e975f09c7c0d0e839853ef8e
7
- data.tar.gz: 456b9e967f28a1d889a481f7db6425e1d1bf3dcdffa414c6bf85521a9abf91489edb97dde20d3ee611b2198dd8c5ae09d3b651e3b95d36e445fe0fa0020ba10a
8
+ metadata.gz: !binary |-
9
+ OTAyNGRiZGVjNDA5YWNiY2U3NTZhN2ExYTg1Mzg0N2EyNWNlNjYxYTIzNmE2
10
+ Yzk4ZDIwZTQ4MThhMWFhOTFkZGNhYjIwNjA0ZTJlOWY0MDA3YmQ2MzI0NGNl
11
+ NGNjYWM3MmUxOGIyOGJjMjEyYjIwNzRhNTM2NTY3NWY2M2QwMjQ=
12
+ data.tar.gz: !binary |-
13
+ OWJkNmY0NTA2NDYxNmU4MDMyNGM0MDEwNTRhOGUyZDUyMzg2NTdlMGQ4Nzll
14
+ MmNjMjE2NTcyNWFkOTRkMWVjZDk4N2JhOTg4OWUzNmQ4NWQ1MGQ1MTMwZGQ3
15
+ NTNlMTRmMjE4MWUyYWFiOTk5ZTBlMzVhMzVjYTM4NDE2ZDk3MTQ=
@@ -20,6 +20,7 @@ class MultiThink::Connection
20
20
  while @tried < @retries do
21
21
  @servers.each do |server|
22
22
  begin
23
+ #TODO(jpg) make timeout configurable
23
24
  Timeout::timeout(1) do
24
25
  @conn = r.connect(server)
25
26
  end
@@ -37,15 +38,26 @@ class MultiThink::Connection
37
38
  def run(query, *args)
38
39
  begin
39
40
  query.run(@conn, *args)
40
- rescue RethinkDB::RqlRuntimeError => e
41
- raise e
42
- rescue RuntimeError => e
43
- if reconnect
44
- retry
41
+ rescue StandardError => e
42
+ if is_connection_error(e)
43
+ retry if reconnect
45
44
  end
46
45
  end
47
46
  end
48
47
 
48
+ def is_connection_error(e)
49
+ case e
50
+ when Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EPIPE,
51
+ Errno::ECONNRESET, Errno::ETIMEDOUT, IOError
52
+ true
53
+ when RethinkDB::RqlRuntimeError
54
+ e.message =~ /cannot perform (read|write): No master available/ ||
55
+ e.message =~ /Error: Connection Closed/
56
+ else
57
+ false
58
+ end
59
+ end
60
+
49
61
  def reconnect
50
62
  begin
51
63
  # try fast path first
@@ -1,3 +1,3 @@
1
1
  class MultiThink
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multithink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Glanville
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rethinkdb
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.10.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 5.0.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 5.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Simple RethinkDB connection pool.
@@ -79,18 +79,19 @@ require_paths:
79
79
  - lib
80
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ! '>='
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ! '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.0.3
92
+ rubygems_version: 2.1.5
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Simple RethinkDB connection pool.
96
96
  test_files: []
97
+ has_rdoc: