File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,19 +69,35 @@ def standalone?
6969 mode . fork? || @options [ :standalone ]
7070 end
7171
72- def validate_recurring_config
73- valid = true
72+ def valid_recurring_config?
73+ invalid = false
74+ invalid_tasks = Hash . new { |hash , key | hash [ key ] = [ ] }
7475 load_config_from ( options [ :recurring_schedule_file ] ) . each do |env , tasks |
7576 tasks . each do |id , options |
76- if options &.has_key? ( :schedule ) && RecurringTask . from_configuration ( id , **options ) . invalid?
77- STDERR . puts "Invalid recurring task #{ id } in #{ env } : #{ options [ :schedule ] } "
78- valid = false
77+ task = RecurringTask . from_configuration ( id , **options )
78+ if task . invalid?
79+ invalid_tasks [ env ] << task
80+ invalid = true
7981 end
8082 end
8183 end
8284
83- puts "All recurring tasks are valid" if valid
84- valid
85+ if invalid
86+ puts "Invalid recurring tasks:"
87+ invalid_tasks . each do |env , tasks |
88+ puts "- #{ env } "
89+ tasks . each do |task |
90+ puts " - #{ task . key } "
91+ task . errors . full_messages . each do |message |
92+ puts " - #{ message } "
93+ end
94+ end
95+ end
96+ false
97+ else
98+ puts "All recurring tasks are valid"
99+ true
100+ end
85101 end
86102
87103 private
Original file line number Diff line number Diff line change 1111
1212 desc "Validates the recurring jobs config"
1313 task validate_recurring_config : :environment do
14- SolidQueue ::Configuration . new . validate_recurring_config
14+ abort unless SolidQueue ::Configuration . new . valid_recurring_config?
1515 end
1616end
You can’t perform that action at this time.
0 commit comments