From a8b1c3c9fda4b0db1feda9cc2d6aebd1a70f92f8 Mon Sep 17 00:00:00 2001 From: Marcus Mansur Date: Thu, 28 Sep 2023 11:06:22 +1000 Subject: [PATCH] test --- lib/patches/test.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/patches/test.rb diff --git a/lib/patches/test.rb b/lib/patches/test.rb new file mode 100644 index 0000000..4b26877 --- /dev/null +++ b/lib/patches/test.rb @@ -0,0 +1,42 @@ +class Patches::TenantRunner + include Patches::TenantRunConcern + attr_accessor :path + + def initialize(path: nil, tenants: nil) + @path = path + @tenants = tenants + end + + def perform + Patches.logger.info("Patches tenant runner for: #{tenants.join(',')}") + tenants.each do |tenant| + if parallel? + Patches::TenantWorker.perform_async( + tenant, + path, + application_version: Patches::Config.configuration.application_version + ) + else + run(tenant, path) + end + end + end + + def tenants + @tenants ||= (Apartment.tenant_names || []) + end + + def tenants2 + @tenants ||= (Apartment.tenant_names || []) + end + + def tenants3 + @tenants ||= (Apartment.tenant_names || []) + end + + private + + def parallel? + Patches::Config.configuration.sidekiq_parallel + end +end