taps 0.2.20 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 20
2
+ :patch: 21
3
3
  :major: 0
4
4
  :minor: 2
data/lib/taps/utils.rb CHANGED
@@ -79,19 +79,21 @@ module Utils
79
79
  begin
80
80
  t1 = Time.now
81
81
  yield chunksize
82
- rescue Errno::EPIPE
82
+ rescue Errno::EPIPE, RestClient::RequestFailed
83
83
  retries += 1
84
84
  raise if retries > 1
85
85
  # we got disconnected, the chunksize could be too large
86
86
  # so we're resetting to a very small value
87
- chunksize = 100
87
+ chunksize = 10
88
88
  retry
89
89
  end
90
90
 
91
91
  t2 = Time.now
92
92
 
93
93
  diff = t2 - t1
94
- new_chunksize = if diff > 3.0
94
+ new_chunksize = if retries > 0
95
+ (chunksize / 3).ceil
96
+ elsif diff > 3.0
95
97
  (chunksize / 3).ceil
96
98
  elsif diff > 1.1
97
99
  chunksize - 100
@@ -100,7 +102,7 @@ module Utils
100
102
  else
101
103
  chunksize + 100
102
104
  end
103
- new_chunksize = 100 if new_chunksize < 100
105
+ new_chunksize = 10 if new_chunksize < 10
104
106
  new_chunksize
105
107
  end
106
108
 
data/spec/utils_spec.rb CHANGED
@@ -45,7 +45,7 @@ describe Taps::Utils do
45
45
  end
46
46
 
47
47
  it "will reset the chunksize to a small value if we got a broken pipe exception" do
48
- Taps::Utils.calculate_chunksize(1000) { |c| raise Errno::EPIPE if c == 1000; c.should == 100 }.should == 200
48
+ Taps::Utils.calculate_chunksize(1000) { |c| raise Errno::EPIPE if c == 1000; c.should == 10 }.should == 10
49
49
  end
50
50
 
51
51
  it "returns a list of columns that are text fields if the database is mysql" do
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.20
4
+ version: 0.2.21
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-10 00:00:00 -08:00
13
+ date: 2009-11-23 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency