resque-scheduler 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +9 -0
- data/lib/resque_scheduler.rb +2 -1
- data/lib/resque_scheduler/server/views/delayed.erb +12 -1
- data/lib/resque_scheduler/version.rb +1 -1
- metadata +3 -2
data/HISTORY.md
ADDED
data/lib/resque_scheduler.rb
CHANGED
@@ -50,6 +50,7 @@ module ResqueScheduler
|
|
50
50
|
# Used internally to stuff the item into the schedule sorted list.
|
51
51
|
# +timestamp+ can be either in seconds or a datetime object
|
52
52
|
# Insertion if O(log(n)).
|
53
|
+
# Returns true if it's the first job to be scheduled at that time, else false
|
53
54
|
def delayed_push(timestamp, item)
|
54
55
|
# First add this item to the list for this timestamp
|
55
56
|
redis.rpush("delayed:#{timestamp.to_i}", encode(item))
|
@@ -72,7 +73,7 @@ module ResqueScheduler
|
|
72
73
|
|
73
74
|
# Returns the number of jobs for a given timestamp in the delayed queue schedule
|
74
75
|
def delayed_timestamp_size(timestamp)
|
75
|
-
redis.llen
|
76
|
+
redis.llen("delayed:#{timestamp.to_i}").to_i
|
76
77
|
end
|
77
78
|
|
78
79
|
# Returns an array of delayed items for the given timestamp
|
@@ -12,11 +12,22 @@
|
|
12
12
|
<tr>
|
13
13
|
<th>Timestamp</th>
|
14
14
|
<th>Job count</th>
|
15
|
+
<th>Class</th>
|
16
|
+
<th>Args</th>
|
15
17
|
</tr>
|
16
18
|
<% resque.delayed_queue_peek(start, start+20).each do |timestamp| %>
|
17
19
|
<tr>
|
18
20
|
<td><a href="<%= url "delayed/#{timestamp}" %>"><%= format_time(Time.at(timestamp)) %></a></td>
|
19
|
-
<td><%= resque.delayed_timestamp_size(timestamp) %></td>
|
21
|
+
<td><%= delayed_timestamp_size = resque.delayed_timestamp_size(timestamp) %></td>
|
22
|
+
<% job = resque.delayed_timestamp_peek(timestamp, 0, 1).first %>
|
23
|
+
<td>
|
24
|
+
<% if job && delayed_timestamp_size == 1 %>
|
25
|
+
<%= h(job['class']) %>
|
26
|
+
<% else %>
|
27
|
+
<a href="<%= url "delayed/#{timestamp}" %>">see details</a>
|
28
|
+
<% end %>
|
29
|
+
</td>
|
30
|
+
<td><%= h(job['args'].inspect) if job && delayed_timestamp_size == 1 %></td>
|
20
31
|
</tr>
|
21
32
|
<% end %>
|
22
33
|
</table>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben VandenBos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-10 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -65,6 +65,7 @@ extra_rdoc_files:
|
|
65
65
|
- README.markdown
|
66
66
|
files:
|
67
67
|
- .gitignore
|
68
|
+
- HISTORY.md
|
68
69
|
- README.markdown
|
69
70
|
- Rakefile
|
70
71
|
- lib/resque/scheduler.rb
|