lib/mini_scheduler/web.rb in mini_scheduler-0.8.0 vs lib/mini_scheduler/web.rb in mini_scheduler-0.8.1
- old
+ new
@@ -20,10 +20,11 @@
end
end
end
app.get "/scheduler" do
+ MiniScheduler.before_sidekiq_web_request&.call
@schedules = Manager.discover_schedules.sort do |a, b|
a_next = a.schedule_info.next_run
b_next = b.schedule_info.next_run
if a_next && b_next
a_next <=> b_next
@@ -35,15 +36,18 @@
end
erb File.read(File.join(VIEWS, 'scheduler.erb')), locals: { view_path: VIEWS }
end
app.get "/scheduler/history" do
+ MiniScheduler.before_sidekiq_web_request&.call
@scheduler_stats = Stat.order('started_at desc').limit(200)
erb File.read(File.join(VIEWS, 'history.erb')), locals: { view_path: VIEWS }
end
app.post "/scheduler/:name/trigger" do
halt 404 unless (name = params[:name])
+
+ MiniScheduler.before_sidekiq_web_request&.call
klass = name.constantize
info = klass.schedule_info
info.next_run = Time.now.to_i
info.write!