diff --git a/app/jobs/send_bulk_message_job.rb b/app/jobs/send_bulk_message_job.rb index 8cb2540..d3a11b3 100644 --- a/app/jobs/send_bulk_message_job.rb +++ b/app/jobs/send_bulk_message_job.rb @@ -4,8 +4,6 @@ class SendBulkMessageJob < ApplicationJob def perform(users) message_jobs = users.map { |user| SendMessageJob.new(user) } - message_jobs.each do |job| - job.perform_now - end + ActiveJob.perform_all_later(message_jobs) end end diff --git a/config/application.rb b/config/application.rb index ddb7052..7b477a1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -16,6 +16,8 @@ class Application < Rails::Application # Common ones are `templates`, `generators`, or `middleware`, for example. config.autoload_lib(ignore: %w[assets tasks]) + config.active_job.queue_adapter = :delayed_job + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/test/lib/scheduler_test.rb b/test/lib/scheduler_test.rb index 9ef8b60..eb0f30b 100644 --- a/test/lib/scheduler_test.rb +++ b/test/lib/scheduler_test.rb @@ -2,7 +2,7 @@ require "rake" class SchedulerTest < ActiveSupport::TestCase - include ActiveJob::TestHelper + # include ActiveJob::QueueAdapters::DelayedJobAdapter setup do ENV["WEEKLY_MESSAGE_DAY"] = "1"