Websites/app/jobs/git_job.rb

24 lines
473 B
Ruby
Raw Normal View History

2024-10-21 06:32:17 +00:00
# frozen_string_literal: true
class GitJob < ApplicationJob
2024-10-21 15:27:38 +00:00
include GoodJob::ActiveJobExtensions::Concurrency
2024-10-21 06:32:17 +00:00
queue_as :git
good_job_control_concurrency_with(perform_limit: 1)
def perform(identifier, *commands)
2024-10-21 06:32:17 +00:00
commands.each do |command|
system!(command)
end
rescue StandardError => e
ExceptionLog.add(e, source: "GitJob", identifier: identifier)
2024-10-21 06:32:17 +00:00
end
private
def system!(*)
system(*, exception: true, chdir: base_path)
end
end