Rykian / clockwork

A scheduler process to replace cron.
MIT License
544 stars 66 forks source link

add rescue to prevent hung up by exception #24

Closed autopp closed 5 years ago

autopp commented 7 years ago

When exception is raised in callback of at:, clockwork hungs up without any message.

E.g.

module Clockwork
  handler {}

  every(1.minute, 'some job', at: ->(time) { raise 'some error' })
end

To prevend this, I added rescue (and logging) to Manager#events_to_run. I hope this help.

olegykz commented 5 years ago

We spent a few hours to find out what is going on with clockwork after someone have added if: -> { ... } (wrong arity, argument missing) This PR could save a lot of nerves and time for others devs - @Rykian what is needed to merge this PR?

Rykian commented 5 years ago

Thanks :)

autopp commented 5 years ago

@Rykian Thanks for merge!