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