Home access all events from clockwork manager to controller
Reply: 0

access all events from clockwork manager to controller

user877
1#
user877 Published in April 26, 2018, 7:56 am

Am using gem clockwork for running scheduled jobs. I need to access all events defined in clock.rb for manually trigger the clockwork events when it fails.

For that I forked the clockwork gem by adding attr_reader: events in clockwork/manager.rb file.

clock.rb

module Clockwork
  every(10.seconds, 'job1') do
    p Clockwork.manager.events
  end
end

By using Clockwork.manager.events in clock.rb it returns all events that defined in clock.rb.

mycontroller.rb

module Admin
  class MyController < AdminController

    require 'clockwork'

    def index
      @events = Clockwork.manager.events
    end
  end
end

But while using it in controller it returns empty value.

How to get all clockwork events in controller?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.541796 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO