Fix observer workers so that they don't raise error if item is already deleted

This commit is contained in:
Wedge 2019-02-10 17:15:46 +03:00
parent e38415c088
commit 7b3d7d27a9
4 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@ module AbfWorker
def real_perform
@subject_class = ProductBuildList
return if !subject
subject.with_lock do
case status
when COMPLETED

View File

@ -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

View File

@ -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