Module: AwsCron::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/aws_cron/controller.rb
Instance Method Summary collapse
-
#run(&block) ⇒ Object
Runs block and ensures error logging and proper JSON return.
-
#run_in_tz(cron_str, &block) ⇒ Object
Runs block using defined timezone for cron scheduling and ensures error logging and proper JSON return.
Instance Method Details
#run(&block) ⇒ Object
Runs block and ensures error logging and proper JSON return
11 12 13 14 15 16 17 |
# File 'lib/aws_cron/controller.rb', line 11 def run(&block) yield rescue => exception AwsCron::log(:error, exception) ensure self.return_object end |
#run_in_tz(cron_str, &block) ⇒ Object
Runs block using defined timezone for cron scheduling and ensures error logging and proper JSON return
For tasks that call this method, make sure to have cron.yaml call this task in way that allows it to check programmatically if it needs to be triggered
25 26 27 28 29 30 31 |
# File 'lib/aws_cron/controller.rb', line 25 def run_in_tz(cron_str, &block) run do CronRunner.new(cron_str, time_provider).run do yield end end end |