Websites/app/jobs/git_job.rb

25 lines
517 B
Ruby

# frozen_string_literal: true
class GitJob < ApplicationJob
include GoodJob::ActiveJobExtensions::Concurrency
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)
raise(e)
end
private
def system!(*)
system(*, exception: true, chdir: Websites.config.yiffy2_storage.base_path)
end
end