]> git.cworth.org Git - sup/commitdiff
Merge branches 'dont-canonicalize-email-addresses', 'multi-remove-labels', 'merge...
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 9 Apr 2009 17:35:50 +0000 (10:35 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 9 Apr 2009 17:35:50 +0000 (10:35 -0700)
1  2  3  4  5  6 
lib/sup/modes/thread-index-mode.rb

index 0beebafb3a13aff407eb62b0b5a4f699d7aa2a3e,73144db9ea9e03e04ba545b6051d524808020606,2be6fd852f1b18016e4c00e46bda94451f90a036,4de4613655e1b9c5c8d1f1caff5ad3a6b0f473b4,6616601d363580dfd440d6c4da9f6fad9b61e077,73144db9ea9e03e04ba545b6051d524808020606..cd9a0277689a9debba64003332345adc96d530fb
          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