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 +4 -4
- data/lib/tapsoob/operation.rb +10 -6
- data/lib/tapsoob/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9e2d75dd19008094d30f87a528281d1a6df5c0b2bda8faa79a67dbeb2bb22ce
|
4
|
+
data.tar.gz: 940c827d7dd14127f99116e66ddaa9ceb0d7fcab0127876748e1b571cde7d140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 537960e95fb5ae7b5e3d2e022c56fdf26ac989017274fea1f59fe8510e30248c8c8c3a060e70515d7b9db2882748962ae2423a3d9f6e1e63acf65c69b2741065
|
7
|
+
data.tar.gz: 027f3de686550ba21a5b44106d005526215e8f06667fcb80f8d6b5783423b453f1d1f4aef9be763bcf2e1ac7d4b25b8898a65d6f93798172203b91367d46e8d3
|
data/lib/tapsoob/operation.rb
CHANGED
@@ -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
|
data/lib/tapsoob/version.rb
CHANGED