Improved error handling of already deleted objects.

This commit is contained in:
Martin Edenhofer 2013-05-23 08:01:30 +02:00
parent 56d56421f3
commit d85565ef9e
2 changed files with 12 additions and 2 deletions

View file

@ -17,10 +17,20 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
# get current state of objects
if event[:name] == 'Ticket::Article'
article = Ticket::Article.lookup( :id => event[:id] )
# next if article is already deleted
next if !article
ticket = article.ticket
else
elsif event[:name] == 'Ticket'
ticket = Ticket.lookup( :id => event[:id] )
# next if ticket is already deleted
next if !ticket
article = ticket.articles[-1]
else
raise "unknown object for notification #{event[:name]}"
end
# send new ticket notification to agents

View file

@ -150,7 +150,7 @@ class TwitterTest < ActiveSupport::TestCase
text,
)
assert( dm, "dm with ##{hash} created" )
sleep 20
sleep 10
# fetch check system account
Channel.fetch