class Patches::TenantRunner

Attributes

path[RW]

Public Class Methods

new(path: nil, tenants: nil) click to toggle source
# File lib/patches/tenant_runner.rb, line 5
def initialize(path: nil, tenants: nil)
  @path = path
  @tenants = tenants
end

Public Instance Methods

perform() click to toggle source
# File lib/patches/tenant_runner.rb, line 10
def perform
  Patches.logger.info("Patches tenant runner for: #{tenants.join(',')}")
  tenants.each do |tenant|
    if parallel?
      Patches::TenantWorker.perform_async(tenant, path)
    else
      run(tenant, path)
    end
  end
end
tenants() click to toggle source
# File lib/patches/tenant_runner.rb, line 21
def tenants
  @tenants ||= (Apartment.tenant_names || [])
end

Private Instance Methods

parallel?() click to toggle source
# File lib/patches/tenant_runner.rb, line 27
def parallel?
  Patches::Config.configuration.sidekiq_parallel
end