8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/clockwork_web/home_controller.rb', line 8
def index
@events =
Clockwork.manager.instance_variable_get(:@events).sort_by do |e|
at = e.instance_variable_get(:@at)
[
e.instance_variable_get(:@period),
(at && at.instance_variable_get(:@hour)) || -1,
(at && at.instance_variable_get(:@min)) || -1,
e.job.to_s
]
end
@last_run = {}
@disabled = {}
if ClockworkWeb.redis
keys = @events.flat_map{|e| ["clockwork:last_run:#{e.job}", "clockwork:disabled:#{e.job}"] }
values = ClockworkWeb.redis.mget(keys)
@events.each_with_index do |event, i|
@last_run[event.job] = values[i * 2]
@disabled[event.job] = values[i * 2 + 1]
end
end
end
|