Removed unused sla get of ticket in Ticket.process_escalation to save system ressources of scheduler.

This commit is contained in:
Martin Edenhofer 2019-10-03 13:43:41 +02:00
parent 6018d864db
commit d01dfce8cb

View file

@ -127,7 +127,7 @@ returns
tickets = where(state_id: next_state_map.keys) tickets = where(state_id: next_state_map.keys)
.where('pending_time <= ?', Time.zone.now) .where('pending_time <= ?', Time.zone.now)
tickets.each do |ticket| tickets.find_each(batch_size: 500) do |ticket|
Transaction.execute do Transaction.execute do
ticket.state_id = next_state_map[ticket.state_id] ticket.state_id = next_state_map[ticket.state_id]
ticket.updated_at = Time.zone.now ticket.updated_at = Time.zone.now
@ -151,7 +151,7 @@ returns
tickets = where(state_id: reminder_state_map.keys) tickets = where(state_id: reminder_state_map.keys)
.where('pending_time <= ?', Time.zone.now) .where('pending_time <= ?', Time.zone.now)
tickets.each do |ticket| tickets.find_each(batch_size: 500) do |ticket|
article_id = nil article_id = nil
article = Ticket::Article.last_customer_agent_article(ticket.id) article = Ticket::Article.last_customer_agent_article(ticket.id)
@ -190,14 +190,8 @@ returns
def self.process_escalation def self.process_escalation
result = [] result = []
# get max warning diff # fetch all escalated and soon to be escalating tickets
where('escalation_at <= ?', Time.zone.now + 15.minutes).find_each(batch_size: 500) do |ticket|
tickets = where('escalation_at <= ?', Time.zone.now + 15.minutes)
tickets.each do |ticket|
# get sla
ticket.escalation_calculation_get_sla
article_id = nil article_id = nil
article = Ticket::Article.last_customer_agent_article(ticket.id) article = Ticket::Article.last_customer_agent_article(ticket.id)