Websites/app/jobs/git_job.rb

22 lines
420 B
Ruby

# frozen_string_literal: true
class GitJob < ApplicationJob
queue_as :git
good_job_control_concurrency_with(perform_limit: 1)
def perform(identifier, *commands)
commands.each do |command|
system!(command)
end
rescue StandardError => e
ExceptionLog.add(e, source: "GitJob", identifier: identifier)
end
private
def system!(*)
system(*, exception: true, chdir: base_path)
end
end