commit 08ebfc402a8e8b42858ba2cbbbef9159aee75552
parent afd6392d0c0dbdbf3228cffa1fcbc7cac568a06f
Author: Gaute Hope <eg@gaute.vetsj.com>
Date: Sat, 10 Aug 2013 15:49:17 +0200
Run write sent message in separate ::Thread
Diffstat:
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lib/sup/modes/edit_message_mode.rb b/lib/sup/modes/edit_message_mode.rb
@@ -484,10 +484,10 @@ protected
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
diff --git a/lib/sup/sent.rb b/lib/sup/sent.rb
@@ -25,11 +25,13 @@ class SentManager
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