Method: BuildBuddy::Recorder#record_build_data_and_start_build
- Defined in:
- lib/build_buddy/recorder.rb
#record_build_data_and_start_build(build_data) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/build_buddy/recorder.rb', line 24 def record_build_data_and_start_build(build_data) builds = @mongo[:builds] begin # Do this to prevent build _id's from being sequential and so reduce risk # of someone guessing a valid build URL. build_data._id = BSON::ObjectId.from_string(SecureRandom.hex(12).to_s) builds.insert_one(build_data.to_h) rescue Mongo::Error::OperationFailure => e retry if e.to_s.start_with?('E11000') # Duplicate key error end Celluloid::Actor[:builder].async.start_build(build_data) end |