awful 0.0.110 → 0.0.111

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
  SHA1:
3
- metadata.gz: 66a636931acf101421264806dd2d2507a17f6b0b
4
- data.tar.gz: 971d772db2f68e04147b9b138dfe2564baef6fd8
3
+ metadata.gz: 05de4d2644881dd896a8f620b8e714406475196f
4
+ data.tar.gz: 73bf3944a1a82890464ce59a5d314d6d55384e5c
5
5
  SHA512:
6
- metadata.gz: d82ae0c797e622d721c3ef7dafdac5ec1cdff8feaae4d8d695a83931b1725e53f5825a2f3e7eddc9ef6ede72341a1901df9d137cd99b0c8b60f137995778a65d
7
- data.tar.gz: 57bf1ec07acd7b0d16bbf118ab9648a85ba603150fd8b7f2045975c14108edff04031c38ecaef82796df0a643bbcb341dba3355b3f6685b2e795a228486d9139
6
+ metadata.gz: abdbece43be134fc09c80656abe98939c6399fbee3d3e5420ace4268d9051b8cf69d150e5486cb1702801015c3a20f171444a20fda1eaadb1f5dad560d838c4c
7
+ data.tar.gz: 109636c3a86b4644fc5a9bb40ab8c29c97b132ac065e44d2dc598cdaaa29bd9311f58b49f96bbf14535166aad995a23af1cb1eb233169b3c1dc0c74c91ba1ef7
@@ -184,11 +184,13 @@ module Awful
184
184
  ## lame progress indicator, pass true for put, false for skip
185
185
  dots = options[:dots] ? ->(x){print x ? '.' : 'x'} : ->(_){}
186
186
 
187
- ## recursive closure to scan some items from src and put to dest;
188
- ## would be more studly as an anonymous y-combinator, but we should write readable code instead
189
- scan_and_put = ->(myself, key) {
190
- r = src_client.scan(table_name: src_table, exclusive_start_key: key, return_consumed_capacity: 'INDEXES')
191
- print "[#{Time.now}] [#{src_table}] scanned:#{r.count} key:#{r.last_evaluated_key || 'nil'}"
187
+ ## loop on each batch of scanned items
188
+ exclusive_start_key = nil
189
+ loop do
190
+ r = src_client.scan(table_name: src_table, exclusive_start_key: exclusive_start_key, return_consumed_capacity: 'INDEXES')
191
+ puts "[#{Time.now}] [#{src_table}] scanned:#{r.count} key:#{r.last_evaluated_key || 'nil'}"
192
+
193
+ ## loop items and put to destination
192
194
  put = skipped = 0
193
195
  r.items.each do |item|
194
196
  begin
@@ -200,17 +202,14 @@ module Awful
200
202
  dots.call(false)
201
203
  end
202
204
  end
203
- print "\n"
204
- puts "[#{Time.now}] [#{dst_table}] put:#{put} skipped:#{skipped}"
205
205
 
206
- ## recurse if there are more keys to scan
207
- if r.last_evaluated_key
208
- myself.call(myself, r.last_evaluated_key)
209
- end
210
- }
206
+ print "\n" if options[:dots]
207
+ puts "[#{Time.now}] [#{dst_table}] put:#{put} skipped:#{skipped}"
211
208
 
212
- ## start scanning data
213
- scan_and_put.call(scan_and_put, nil)
209
+ ## loop if there are more keys to scan
210
+ exclusive_start_key = r.last_evaluated_key
211
+ break unless exclusive_start_key
212
+ end
214
213
  end
215
214
 
216
215
  desc 'scan NAME', 'scan table with NAME'
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.110'
2
+ VERSION = '0.0.111'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.110
4
+ version: 0.0.111
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler