Performance improvement for follow up detection.

This commit is contained in:
Martin Edenhofer 2017-07-31 14:47:35 +02:00
parent 86430e9e33
commit d17906f333
2 changed files with 4 additions and 3 deletions

View file

@ -112,8 +112,6 @@ module Channel::Filter::IdentifySender
display_name = nil
if recipient =~ /.*<(.+?)>/
address = $1
elsif recipient =~ /<(.+?)>/
address = $1
end
if recipient =~ /^(.+?)<(.+?)>/
display_name = $1

View file

@ -47,7 +47,10 @@ class Channel::Filter::MonitoringBase
# follow up detection by meta data
open_states = Ticket::State.by_category(:open)
Ticket.where(state: open_states).each { |ticket|
ticket_ids = Ticket.where(state: open_states).order(created_at: :desc).limit(5000).pluck(:id)
ticket_ids.each { |ticket_id|
ticket = Ticket.find_by(id: ticket_id)
next if !ticket
next if !ticket.preferences
next if !ticket.preferences['integration']
next if ticket.preferences['integration'] != integration