diff --git a/lib/solid_queue/configuration.rb b/lib/solid_queue/configuration.rb index c9e44901..ba13f0f4 100644 --- a/lib/solid_queue/configuration.rb +++ b/lib/solid_queue/configuration.rb @@ -141,7 +141,7 @@ def dispatchers_options def recurring_tasks @recurring_tasks ||= recurring_tasks_config.map do |id, options| - RecurringTask.from_configuration(id, **options) if options.has_key?(:schedule) + RecurringTask.from_configuration(id, **options) if options&.has_key?(:schedule) end.compact end @@ -153,7 +153,9 @@ def processes_config end def recurring_tasks_config - @recurring_tasks_config ||= config_from options[:recurring_schedule_file] + @recurring_tasks_config ||= begin + config_from options[:recurring_schedule_file] + end end diff --git a/test/unit/configuration_test.rb b/test/unit/configuration_test.rb index 11653c25..68a693e3 100644 --- a/test/unit/configuration_test.rb +++ b/test/unit/configuration_test.rb @@ -103,6 +103,10 @@ class ConfigurationTest < ActiveSupport::TestCase assert configuration.valid? assert_processes configuration, :scheduler, 0 + configuration = SolidQueue::Configuration.new(recurring_schedule_file: config_file_path(:recurring_with_empty)) + assert configuration.valid? + assert_processes configuration, :scheduler, 0 + # No processes configuration = SolidQueue::Configuration.new(skip_recurring: true, dispatchers: [], workers: []) assert_not configuration.valid?