Skip to content

Commit

Permalink
Merge pull request resque#361 from meatballhat/YotpoLtd-feature-last-…
Browse files Browse the repository at this point in the history
…execution

@vladshub feature last execution
  • Loading branch information
ksinkar committed Feb 20, 2014
2 parents 57b877d + 595f35b commit 04924e0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CaseEquality:
# Offence count: 1
# Configuration parameters: CountComments.
ClassLength:
Max: 341
Max: 342

# Offence count: 4
CyclomaticComplexity:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Resque Scheduler authors
- Tim Liner
- Tony Lewis
- Vincent Zhu
- Vladislav Shub
- V Sreekanth
- andreas
- bbauer
Expand Down
1 change: 1 addition & 0 deletions lib/resque/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def load_schedule_job(name, config)
job = rufus_scheduler.send(interval_type, *args) do
if master?
log! "queueing #{config['class']} (#{name})"
Resque.last_enqueued_at(name, Time.now.to_s)
handle_errors { enqueue_from_config(config) }
end
end
Expand Down
8 changes: 8 additions & 0 deletions lib/resque_scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ def scheduled_at(klass, *args)
end
end

def last_enqueued_at(job_name, date)
redis.hset('delayed:last_enqueued_at', job_name, date)
end

def get_last_enqueued_at(job_name)
redis.hget('delayed:last_enqueued_at', job_name)
end

private

def job_to_hash(klass, args)
Expand Down
5 changes: 4 additions & 1 deletion lib/resque_scheduler/server/views/scheduler.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
a job immediately.
Server local time: <%= Time.now %>
</p>

<div style="overflow-y: auto; width:100%; padding: 0px 5px;">
<table>
<tr>
<th></th>
Expand All @@ -15,6 +15,7 @@
<th>Class</th>
<th>Queue</th>
<th>Arguments</th>
<th>Last Enqueued</th>
</tr>
<% Resque.schedule.keys.sort.each do |name| %>
<% config = Resque.schedule[name] %>
Expand All @@ -31,6 +32,8 @@
<td><%= h schedule_class(config) %></td>
<td><%= h config['queue'] || queue_from_class_name(config['class']) %></td>
<td><%= h config['args'].inspect %></td>
<td><%= h Resque.get_last_enqueued_at(name) || 'Never' %></td>
</tr>
<% end %>
</table>
</div>

0 comments on commit 04924e0

Please sign in to comment.