Skip to content
Permalink
Browse files

Removed unused sla get of ticket in Ticket.process_escalation to save…

… system ressources of scheduler.
  • Loading branch information...
zammad-sync committed Oct 3, 2019
1 parent 6018d86 commit d01dfce8cb94d6ca61d2e94bcef2b470a4f0aa26
Showing with 4 additions and 10 deletions.
  1. +4 −10 app/models/ticket.rb
@@ -127,7 +127,7 @@ def self.process_pending
tickets = where(state_id: next_state_map.keys)
.where('pending_time <= ?', Time.zone.now)

tickets.each do |ticket|
tickets.find_each(batch_size: 500) do |ticket|
Transaction.execute do
ticket.state_id = next_state_map[ticket.state_id]
ticket.updated_at = Time.zone.now
@@ -151,7 +151,7 @@ def self.process_pending
tickets = where(state_id: reminder_state_map.keys)
.where('pending_time <= ?', Time.zone.now)

tickets.each do |ticket|
tickets.find_each(batch_size: 500) do |ticket|

article_id = nil
article = Ticket::Article.last_customer_agent_article(ticket.id)
@@ -190,14 +190,8 @@ def self.process_pending
def self.process_escalation
result = []

# get max warning diff

tickets = where('escalation_at <= ?', Time.zone.now + 15.minutes)

tickets.each do |ticket|

# get sla
ticket.escalation_calculation_get_sla
# fetch all escalated and soon to be escalating tickets
where('escalation_at <= ?', Time.zone.now + 15.minutes).find_each(batch_size: 500) do |ticket|

article_id = nil
article = Ticket::Article.last_customer_agent_article(ticket.id)

0 comments on commit d01dfce

Please sign in to comment.
You can’t perform that action at this time.