From ca63818181fba44bf402e1142ecaa7f670349d44 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 7 Nov 2019 15:46:11 -0600 Subject: [PATCH] Add EmailListCreateJob --- app/jobs/email_list_create_job.rb | 7 +++++++ lib/insert/insert_email_lists.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 app/jobs/email_list_create_job.rb diff --git a/app/jobs/email_list_create_job.rb b/app/jobs/email_list_create_job.rb new file mode 100644 index 00000000..21795976 --- /dev/null +++ b/app/jobs/email_list_create_job.rb @@ -0,0 +1,7 @@ +class EmailListCreateJob < ApplicationJob + queue_as :default + + def perform(npo_id) + UpdateEmailLists.populate_lists_on_mailchimp(npo_id) + end +end diff --git a/lib/insert/insert_email_lists.rb b/lib/insert/insert_email_lists.rb index 194ed56e..d19c37e3 100644 --- a/lib/insert/insert_email_lists.rb +++ b/lib/insert/insert_email_lists.rb @@ -36,7 +36,7 @@ module InsertEmailLists .returning('*') .execute - UpdateEmailLists.delay.populate_lists_on_mailchimp(npo_id) + EmailListCreateJob.perform_later(npo_id) { deleted: deleted, deleted_result: result, inserted_lists: inserted_lists, inserted_result: lists } end