Skip to content

Commit

Permalink
Run write sent message in separate ::Thread
Browse files Browse the repository at this point in the history
  • Loading branch information
gauteh committed Aug 10, 2013
1 parent afd6392 commit 08ebfc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/sup/modes/edit_message_mode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,10 @@ def send_message
m = build_message date

if HookManager.enabled? "sendmail"
if not HookManager.run "sendmail", :message => m, :account => acct
warn "Sendmail hook was not successful"
return false
end
if not HookManager.run "sendmail", :message => m, :account => acct
warn "Sendmail hook was not successful"
return false
end
else
IO.popen(acct.sendmail, "w") { |p| p.puts m }
raise SendmailCommandFailed, "Couldn't execute #{acct.sendmail}" unless $? == 0
Expand Down
10 changes: 6 additions & 4 deletions lib/sup/sent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ def default_source
end

def write_sent_message date, from_email, &block
debug "store the sent message (locking sent source..)"
@source.poll_lock.synchronize do
@source.store_message date, from_email, &block
::Thread.new do
debug "store the sent message (locking sent source..)"
@source.poll_lock.synchronize do
@source.store_message date, from_email, &block
end
PollManager.poll_from @source
end
PollManager.poll_from @source
end
end

Expand Down

0 comments on commit 08ebfc4

Please sign in to comment.