taps 0.2.21 → 0.2.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 21
2
+ :patch: 22
3
3
  :major: 0
4
4
  :minor: 2
@@ -81,10 +81,12 @@ module Utils
81
81
  yield chunksize
82
82
  rescue Errno::EPIPE, RestClient::RequestFailed
83
83
  retries += 1
84
- raise if retries > 1
84
+ raise if retries > 2
85
+
85
86
  # we got disconnected, the chunksize could be too large
86
- # so we're resetting to a very small value
87
- chunksize = 10
87
+ # on first retry change to 10, on successive retries go down to 1
88
+ chunksize = (retries == 1) ? 10 : 1
89
+
88
90
  retry
89
91
  end
90
92
 
@@ -92,7 +94,7 @@ module Utils
92
94
 
93
95
  diff = t2 - t1
94
96
  new_chunksize = if retries > 0
95
- (chunksize / 3).ceil
97
+ chunksize
96
98
  elsif diff > 3.0
97
99
  (chunksize / 3).ceil
98
100
  elsif diff > 1.1
@@ -102,7 +104,7 @@ module Utils
102
104
  else
103
105
  chunksize + 100
104
106
  end
105
- new_chunksize = 10 if new_chunksize < 10
107
+ new_chunksize = 1 if new_chunksize < 1
106
108
  new_chunksize
107
109
  end
108
110
 
@@ -48,6 +48,10 @@ describe Taps::Utils do
48
48
  Taps::Utils.calculate_chunksize(1000) { |c| raise Errno::EPIPE if c == 1000; c.should == 10 }.should == 10
49
49
  end
50
50
 
51
+ it "will reset the chunksize to a small value if we got a broken pipe exception a second time" do
52
+ Taps::Utils.calculate_chunksize(1000) { |c| raise Errno::EPIPE if c == 1000 || c == 10; c.should == 1 }.should == 1
53
+ end
54
+
51
55
  it "returns a list of columns that are text fields if the database is mysql" do
52
56
  @db = mock("db")
53
57
  @db.class.stubs(:to_s).returns("Sequel::MySQL::Database")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.21
4
+ version: 0.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Chimal, Jr.
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-23 00:00:00 -08:00
13
+ date: 2009-11-24 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency