PERF: Memoize `EmailReceiver#sent_to_mailinglist_mirror?`.

This commit is contained in:
Guo Xiang Tan 2018-08-21 15:44:47 +08:00
parent 6acba44ed9
commit 791ddb8630
1 changed files with 8 additions and 6 deletions

View File

@ -527,14 +527,16 @@ module Email
end
def sent_to_mailinglist_mirror?
destinations.each do |destination|
next unless destination[:type] == :category
@sent_to_mailinglist_mirror ||= begin
destinations.each do |destination|
next unless destination[:type] == :category
category = destination[:obj]
return true if category.mailinglist_mirror?
category = destination[:obj]
return true if category.mailinglist_mirror?
end
false
end
false
end
def self.check_address(address)