Add mutex around incoming email processing

This commit is contained in:
Régis Hanol 2017-05-18 01:09:51 +02:00
parent 2a5a01af2e
commit 80435cf2af
1 changed files with 10 additions and 6 deletions

View File

@ -39,6 +39,8 @@ module Email
def process!
return if is_blacklisted?
DistributedMutex.synchronize(@message_id) do
begin
@from_email, @from_display_name = parse_from_field(@mail)
@incoming_email = find_or_create_incoming_email
process_internal
@ -46,6 +48,8 @@ module Email
@incoming_email.update_columns(error: e.to_s) if @incoming_email
raise
end
end
end
def is_blacklisted?
return false if SiteSetting.ignore_by_title.blank?