tapsoob 0.5.26 → 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: 9f19b27231e8231c5a11cb879256df846b2963712eb9a335549f7c3199144b74
4
- data.tar.gz: 792abe05f841fe4aa5a55de950d371f0ba23bb0d1ebfcb4e7c6ab76b695cd47d
3
+ metadata.gz: d9e2d75dd19008094d30f87a528281d1a6df5c0b2bda8faa79a67dbeb2bb22ce
4
+ data.tar.gz: 940c827d7dd14127f99116e66ddaa9ceb0d7fcab0127876748e1b571cde7d140
5
5
  SHA512:
6
- metadata.gz: d0ca8097f4ba556ef856e33b8c9e6e03c68636af1dc2c6d1896d3c399d5835cedb2de3d889bef199e903efc09eb2a3da74a9f9e2806dcc7a178bd3cda37c175f
7
- data.tar.gz: 6a9c81e0acc7eca5296e718bd3e20bc224b23cb788b16d8b9651e48eda87cde3bcece13159d0ffcae4ff4d2e8b71144d818b2eef276dd7e967e1fd6020a5292c
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,8 +252,8 @@ module Tapsoob
249
252
  stream.fetch_data_from_database(data) do |rows|
250
253
  next if rows == {}
251
254
 
252
- # Update progress bar immediately when data is ready, before I/O
253
- progress.inc(row_size) if progress
255
+ # Update progress bar by 1 chunk
256
+ progress.inc(1) if progress
254
257
 
255
258
  if dump_path.nil?
256
259
  puts JSON.generate(rows)
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.5.26".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.26
4
+ version: 0.5.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger