Run `Ci::Runner#assign_to` in transaction

This commit is contained in:
Kamil Trzciński 2018-05-28 15:31:46 +02:00 committed by Dylan Griffith
parent bf74e69eeb
commit 2ccbe4fd34
1 changed files with 9 additions and 2 deletions

View File

@ -120,8 +120,15 @@ module Ci
raise ArgumentError, 'Transitioning a group runner to a project runner is not supported'
end
self.projects << project
self.save
begin
transaction do
self.projects << project
self.save!
end
rescue ActiveRecord::RecordInvalid => e
self.errors.add(:assign_to, e.message)
false
end
end
def display_name