From: William Morgan Date: Thu, 9 Apr 2009 17:35:50 +0000 (-0700) Subject: Merge branches 'dont-canonicalize-email-addresses', 'multi-remove-labels', 'merge... X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=25d762eeebe5bf69f2c952ce369ba348a6d55a24;p=sup Merge branches 'dont-canonicalize-email-addresses', 'multi-remove-labels', 'merge-labels', 'background-save' and 'encoding-misspellings' --- 25d762eeebe5bf69f2c952ce369ba348a6d55a24 diff --cc lib/sup/modes/thread-index-mode.rb index 0beebaf,73144db,2be6fd8,4de4613,6616601,73144db..cd9a027 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@@@@@@ -385,15 -385,15 -385,15 -385,14 -387,25 -385,15 +387,25 @@@@@@@ EO BufferManager.flash "#{threads.size.pluralize 'Thread'} killed." end ---- - def save --- - BufferManager.say("Saving contacts...") { ContactManager.instance.save } ---- - dirty_threads = @mutex.synchronize { (@threads + @hidden_threads.keys).select { |t| t.dirty? } } ---- - return if dirty_threads.empty? ++++ + def save background=true ++++ + if background ++++ + Redwood::reporting_thread("saving thread") { actually_save } ++++ + else ++++ + actually_save ++++ + end ++++ + end ++ + + - BufferManager.say("Saving threads...") do |say_id| - dirty_threads.each_with_index do |t, i| - BufferManager.say "Saving modified thread #{i + 1} of #{dirty_threads.length}...", say_id - t.save Index ++++ + def actually_save ++++ + @save_thread_mutex.synchronize do ++++ + BufferManager.say("Saving contacts...") { ContactManager.instance.save } ++++ + dirty_threads = @mutex.synchronize { (@threads + @hidden_threads.keys).select { |t| t.dirty? } } ++++ + next if dirty_threads.empty? + -- - - BufferManager.say("Saving threads...") do |say_id| -- - - dirty_threads.each_with_index do |t, i| -- - - BufferManager.say "Saving modified thread #{i + 1} of #{dirty_threads.length}...", say_id -- - - t.save Index ++++ + BufferManager.say("Saving threads...") do |say_id| ++++ + dirty_threads.each_with_index do |t, i| ++++ + BufferManager.say "Saving modified thread #{i + 1} of #{dirty_threads.length}...", say_id ++++ + t.save Index ++++ + end end end end