bin/sup-sync in sup-0.4 vs bin/sup-sync in sup-0.5

- old
+ new

@@ -131,11 +131,11 @@ sources.each do |source| $stderr.puts "Scanning #{source}..." num_added = num_updated = num_scanned = num_restored = 0 last_info_time = start_time = Time.now - Redwood::PollManager.add_messages_from source do |m, offset, entry| + Redwood::PollManager.add_messages_from source, :force_overwrite => true do |m, offset, entry| num_scanned += 1 seen[m.id] = true ## skip if we're operating only on changed messages, the message ## is in the index, and it's unchanged from what the source is @@ -225,10 +225,12 @@ end end $stderr.puts "Deleted #{num_del} / #{num_scanned} messages" end + index.save + if opts[:optimize] $stderr.puts "Optimizing index..." optt = time { index.index.optimize unless opts[:dry_run] } $stderr.puts "Optimized index of size #{index.size} in #{optt}s." end @@ -236,9 +238,8 @@ $stderr.puts "Sorry, I couldn't communicate with a source: #{e.message}" rescue Exception => e File.open("sup-exception-log.txt", "w") { |f| f.puts e.backtrace } raise ensure - index.save Redwood::finish index.unlock end