clockwork_web icon indicating copy to clipboard operation
clockwork_web copied to clipboard

Add new Run Now button + fix on callback

Open chaadow opened this issue 1 year ago • 0 comments

There are times where we don't want to wait for the event to happen and manually execute/run the event.

This PR introduces:

  • a new Run now button next to the Enable/Disable button

    • After carefully reading clockwork source code, using event.run(Time.now) handles the setting of event.last
    • it also calls set_last_run to update redis as well.
  • Setting Last run in after_run callback

    • I usually have every(1.minutes, 'job_name') { SomeSidekiqJob.perform_async }
    • What can happen here, is that the block can raise an exception. For my case, it can be redis ( the one for Sidekiq not clockwork_web) is down or Out Of Memory for example. But it can also be any ruby error
    • So setting "last_run" on Clockwork_web's redis after being run is a safer and more accurate way to set it than setting it before it's run, which can be misleading

    Here is a screenshot:

image

chaadow avatar Sep 13 '24 20:09 chaadow