Fix observer workers so that they don't raise error if item is already deleted
This commit is contained in:
parent
e38415c088
commit
7b3d7d27a9
|
@ -24,7 +24,7 @@ module AbfWorker
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def subject
|
def subject
|
||||||
@subject ||= @subject_class.find(options['id'])
|
@subject ||= @subject_class.find(options['id']) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_results
|
def update_results
|
||||||
|
|
|
@ -4,6 +4,7 @@ module AbfWorker
|
||||||
|
|
||||||
def real_perform
|
def real_perform
|
||||||
@subject_class = ProductBuildList
|
@subject_class = ProductBuildList
|
||||||
|
return if !subject
|
||||||
subject.with_lock do
|
subject.with_lock do
|
||||||
case status
|
case status
|
||||||
when COMPLETED
|
when COMPLETED
|
||||||
|
|
|
@ -4,6 +4,7 @@ module AbfWorker
|
||||||
|
|
||||||
def real_perform
|
def real_perform
|
||||||
@subject_class = BuildList
|
@subject_class = BuildList
|
||||||
|
return if !subject
|
||||||
return if status == STARTED # do nothing when publication started
|
return if status == STARTED # do nothing when publication started
|
||||||
extra = options['extra']
|
extra = options['extra']
|
||||||
repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first
|
repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first
|
||||||
|
|
|
@ -11,10 +11,11 @@ module AbfWorker
|
||||||
|
|
||||||
def real_perform
|
def real_perform
|
||||||
@subject_class = BuildList
|
@subject_class = BuildList
|
||||||
|
return if !subject
|
||||||
unless subject.valid? && restart_task
|
unless subject.valid? && restart_task
|
||||||
if options['feedback_from_user']
|
if options['feedback_from_user']
|
||||||
user = User.find options['feedback_from_user']
|
user = User.find options['feedback_from_user']
|
||||||
raise ActiveRecord::Rollback if !user.system? && subject.builder != user
|
return if !user.system? && subject.builder != user
|
||||||
end
|
end
|
||||||
|
|
||||||
fill_container_data if status != STARTED
|
fill_container_data if status != STARTED
|
||||||
|
|
Loading…
Reference in New Issue