From 3adb8fb13857cd56a0c8937e955702faa431a3b8 Mon Sep 17 00:00:00 2001 From: Vibol Teav Date: Fri, 25 Aug 2023 16:05:55 +0700 Subject: [PATCH] fix worker --- app/workers/organization_worker.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/workers/organization_worker.rb b/app/workers/organization_worker.rb index 7ea135cb15..2596178d3b 100644 --- a/app/workers/organization_worker.rb +++ b/app/workers/organization_worker.rb @@ -5,7 +5,13 @@ class OrganizationWorker def perform(org_id) organization = Organization.find(org_id) - Apartment::Tenant.create(organization.short_name) + begin + Apartment::Tenant.create(organization.short_name) + else Apartment::TenantExists => e + Rails.logger.info "Tenant #{organization.short_name} already exists" + # Continue + end + organisation.update(onboarding_status: 'seeding_default_data') Organization.seed_generic_data(organization.id, organization.referral_source_category_name)