nne_client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -95,6 +95,12 @@ To set a 5 second expiration on reads from NNE do:
95
95
  config.http_read_timeout = 5
96
96
  end
97
97
 
98
+ Alternatively use `with_timeout`:
99
+
100
+ NNEClient.with_timeout(3) do
101
+ ...
102
+ end
103
+
98
104
  ## Contributing
99
105
 
100
106
  1. Fork it
@@ -1,3 +1,3 @@
1
1
  module NNEClient
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/nne_client.rb CHANGED
@@ -40,6 +40,14 @@ module NNEClient
40
40
  NNEClient::Search.new(query).result_set
41
41
  end
42
42
 
43
+ def with_timeout(seconds, &block)
44
+ old_timeout = NNEClient.config.http_read_timeout
45
+ NNEClient.config.http_read_timeout = seconds
46
+ yield
47
+ ensure
48
+ NNEClient.config.http_read_timeout = old_timeout
49
+ end
50
+
43
51
  def retry_timeouts(count, &block)
44
52
  retries = 3
45
53
  begin
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nne_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jacob Atzen