travis-api/lib/travis/api/workers/job_restart.rb
Tyranja a9c31fa5e9 Extract cancel and restart builds and jobs into sidekiq worker
See below for all the commit messages squashed into this one...
add a test

delete empty space

add job_cancellation worker

change id

change job_id param

add job restart worker

add require to sidekiq.rb

change params

add test for job restart and cancellation

add test for job restart

update build.rb improve build spec

update job restart with correct response, add test to chack for correct response when restarting job
2015-01-26 17:29:13 +01:00

20 lines
387 B
Ruby

require 'sidekiq/worker'
require 'multi_json'
module Travis
module Sidekiq
class JobRestart
class ProcessingError < StandardError; end
include ::Sidekiq::Worker
sidekiq_options queue: :job_restarts
def perform(data)
user = User.find(data['user_id'])
Travis.service(:reset_model, user, job_id: data['id']).run
end
end
end
end