feat(task): task enqueueing a maintenance task runnable on deploy

This commit is contained in:
Colin Darie 2024-09-23 18:32:13 +02:00
parent 2127f8cef1
commit cae5d8afed
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,24 @@
# frozen_string_literal: true
module Maintenance
module RunnableOnDeployConcern
extend ActiveSupport::Concern
class_methods do
def run_on_first_deploy
@run_on_first_deploy = true
end
def run_on_deploy?
return false unless @run_on_first_deploy
task = MaintenanceTasks::TaskDataShow.new(name)
return false if task.completed_runs.not_errored.any?
return false if task.active_runs.any?
true
end
end
end
end