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
|
||||
|
||||
def subject
|
||||
@subject ||= @subject_class.find(options['id'])
|
||||
@subject ||= @subject_class.find(options['id']) rescue nil
|
||||
end
|
||||
|
||||
def update_results
|
||||
|
|
|
@ -4,6 +4,7 @@ module AbfWorker
|
|||
|
||||
def real_perform
|
||||
@subject_class = ProductBuildList
|
||||
return if !subject
|
||||
subject.with_lock do
|
||||
case status
|
||||
when COMPLETED
|
||||
|
|
|
@ -4,6 +4,7 @@ module AbfWorker
|
|||
|
||||
def real_perform
|
||||
@subject_class = BuildList
|
||||
return if !subject
|
||||
return if status == STARTED # do nothing when publication started
|
||||
extra = options['extra']
|
||||
repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first
|
||||
|
|
|
@ -11,10 +11,11 @@ module AbfWorker
|
|||
|
||||
def real_perform
|
||||
@subject_class = BuildList
|
||||
return if !subject
|
||||
unless subject.valid? && restart_task
|
||||
if 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
|
||||
|
||||
fill_container_data if status != STARTED
|
||||
|
|
Loading…
Reference in New Issue