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 ADDED
@@ -0,0 +1,9 @@
1
+ ## 1.0.2 (2010-02-?)
2
+
3
+ * Change Delayed Job tab to display job details if only 1 job exists
4
+ for a given timestamp
5
+
6
+ ## 1.0.1 (2010-01-?)
7
+
8
+ * Bugfix: delayed jobs close together resulted in a 5 second sleep
9
+
@@ -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 "delayed:#{timestamp.to_i}"
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>
@@ -1,3 +1,3 @@
1
1
  module ResqueScheduler
2
- Version = '1.0.1'
2
+ Version = '1.0.2'
3
3
  end
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.1
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-01 00:00:00 -08:00
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