tapsoob 0.5.25 → 0.5.27

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,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87f86ef24606eac9b07a505455b518402d33d522b8e14420dfe36fbcc38beb78
4
- data.tar.gz: 46722746c4d5c6ec5247f28cb5d05d33f55d78e3a8fd7ee560096c097351c9fd
3
+ metadata.gz: d9e2d75dd19008094d30f87a528281d1a6df5c0b2bda8faa79a67dbeb2bb22ce
4
+ data.tar.gz: 940c827d7dd14127f99116e66ddaa9ceb0d7fcab0127876748e1b571cde7d140
5
5
  SHA512:
6
- metadata.gz: 2de7d2c3841e96e5b322cec4079b6d70a6b8fe761fde5e4b3799676cb61af6f2f38efed8a95ff40470b783db0897e21e93e44da541507b351e0f7c814fb18242
7
- data.tar.gz: 363345d8ad6ce7847e1480c70e26cfabc6f27a8d9581b1f33e7bd7c9df3d270b8d9f7cec4cb6e267e234fbc15f3f5b70a5e5d559f979fbf09e15621f8b235789
6
+ metadata.gz: 537960e95fb5ae7b5e3d2e022c56fdf26ac989017274fea1f59fe8510e30248c8c8c3a060e70515d7b9db2882748962ae2423a3d9f6e1e63acf65c69b2741065
7
+ data.tar.gz: 027f3de686550ba21a5b44106d005526215e8f06667fcb80f8d6b5783423b453f1d1f4aef9be763bcf2e1ac7d4b25b8898a65d6f93798172203b91367d46e8d3
@@ -198,11 +198,12 @@ module Tapsoob
198
198
  log.info "#{tables.size} tables, #{format_number(record_count)} records"
199
199
 
200
200
  tables.each do |table_name, count|
201
- progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, count) : nil)
202
201
  stream = Tapsoob::DataStream.factory(db, {
203
202
  :chunksize => default_chunksize,
204
203
  :table_name => table_name
205
204
  }, { :debug => opts[:debug] })
205
+ estimated_chunks = (count.to_f / default_chunksize).ceil
206
+ progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, estimated_chunks) : nil)
206
207
  pull_data_from_table(stream, progress)
207
208
  end
208
209
  end
@@ -214,8 +215,10 @@ module Tapsoob
214
215
  record_count = tables[table_name.to_s]
215
216
  log.info "Resuming #{table_name}, #{format_number(record_count)} records"
216
217
 
217
- progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, record_count) : nil)
218
218
  stream = Tapsoob::DataStream.factory(db, stream_state)
219
+ chunksize = stream_state[:chunksize] || default_chunksize
220
+ estimated_chunks = (record_count.to_f / chunksize).ceil
221
+ progress = (opts[:progress] ? ProgressBar.new(table_name.to_s, estimated_chunks) : nil)
219
222
  pull_data_from_table(stream, progress)
220
223
  end
221
224
 
@@ -249,6 +252,9 @@ module Tapsoob
249
252
  stream.fetch_data_from_database(data) do |rows|
250
253
  next if rows == {}
251
254
 
255
+ # Update progress bar by 1 chunk
256
+ progress.inc(1) if progress
257
+
252
258
  if dump_path.nil?
253
259
  puts JSON.generate(rows)
254
260
  else
@@ -258,9 +264,9 @@ module Tapsoob
258
264
  log.debug "row size: #{row_size}"
259
265
  stream.error = false
260
266
  self.stream_state = stream.to_hash
261
-
267
+
262
268
  c.idle_secs = (d1 + d2)
263
-
269
+
264
270
  elapsed_time
265
271
  end
266
272
  rescue Tapsoob::CorruptedData => e
@@ -268,8 +274,6 @@ module Tapsoob
268
274
  stream.error = true
269
275
  next
270
276
  end
271
-
272
- progress.inc(row_size) if progress
273
277
 
274
278
  break if stream.complete?
275
279
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.5.25".freeze
3
+ VERSION = "0.5.27".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapsoob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.25
4
+ version: 0.5.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger