resque 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of resque might be problematic. Click here for more details.

@@ -1,28 +1,32 @@
1
1
  * Chris Wanstrath
2
2
  * gravis
3
- * John Barnette
4
3
  * scotttam
4
+ * John Barnette
5
+ * Mike Mangino
6
+ * Rob Hanlon
7
+ * Jason Amster
5
8
  * Aaron Quint
6
9
  * Adam Cooke
7
10
  * Ashley Martens
8
- * Jason Amster
9
- * Mike Mangino
10
- * Rob Hanlon
11
- * jgeiger
12
- * Roman Heinrich
13
- * Thibaut Barrère
14
11
  * Matt Duncan
12
+ * Michael Dwan
15
13
  * Daniel Ceballos
16
- * Ben VandenBos
17
- * Christos Trochalakis
18
- * Roland Moriz
14
+ * Roman Heinrich
15
+ * Thibaut Barrère
16
+ * jgeiger
19
17
  * Simon Rozet
20
- * Brian P O'Rourke
21
- * PJ Hyett
18
+ * Dave Hoover
19
+ * Christos Trochalakis
20
+ * Ben VandenBos
21
+ * snusnu
22
+ * Arthur Zapparoli
22
23
  * Ben Marini
24
+ * Brian P O'Rourke
25
+ * Jim Remsik and Les Hill
23
26
  * Karel Minarik
27
+ * Luc Castera
24
28
  * Masatomo Nakano
25
29
  * Matt Palmer
26
- * Michael Dwan
27
- * Dave Hoover
28
- * Arthur Zapparoli
30
+ * PJ Hyett
31
+ * Roland Moriz
32
+ * malomalo
data/HISTORY.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.6.1 (2010-03-25)
2
+
3
+ * Bugfix: Workers may not be clearing their state correctly on
4
+ shutdown
5
+ * Added example monit config.
6
+ * Exception class is now recorded when an error is raised in a
7
+ worker.
8
+ * web: Unit tests
9
+ * web: Show namespace in header and footer
10
+ * web: Remove a queue
11
+ * web: Retry failed jobs
12
+
1
13
  ## 1.6.0 (2010-03-09)
2
14
 
3
15
  * Added `before_first_fork`, `before_fork`, and `after_fork` hooks.
@@ -648,6 +648,9 @@ this way we can tell our Sinatra app about the config file:
648
648
 
649
649
  Now everyone is on the same page.
650
650
 
651
+ Worker Hooks
652
+ ------------
653
+
651
654
  If you wish to have a Proc called before the worker forks for the
652
655
  first time, you can add it in the initializer like so:
653
656
 
@@ -658,7 +661,7 @@ first time, you can add it in the initializer like so:
658
661
  You can also run a hook before _every_ fork:
659
662
 
660
663
  Resque.before_fork do |job|
661
- puts "CALL ME ONCE BEFORE THE WORKER FORKS THE FIRST TIME"
664
+ puts "CALL ME BEFORE THE WORKER FORKS"
662
665
  end
663
666
 
664
667
  The `before_fork` hook will be run in the **parent** process. So, be
@@ -668,7 +671,7 @@ the worker.
668
671
  And after forking:
669
672
 
670
673
  Resque.after_fork do |job|
671
- puts "CALL ME ONCE BEFORE THE WORKER FORKS THE FIRST TIME"
674
+ puts "CALL ME AFTER THE WORKER FORKS"
672
675
  end
673
676
 
674
677
  The `after_fork` hook will be run in the child process and is passed
@@ -679,6 +682,7 @@ All hooks can also be set using a setter, e.g.
679
682
 
680
683
  Resque.after_fork = proc { puts "called" }
681
684
 
685
+
682
686
  Namespaces
683
687
  ----------
684
688
 
@@ -797,4 +801,4 @@ Chris Wanstrath :: chris@ozmm.org :: @defunkt
797
801
  [2]: http://github.com/defunkt/resque/issues
798
802
  [sv]: http://semver.org/
799
803
  [rs]: http://github.com/defunkt/redis-namespace
800
- [cb]: http://wiki.github.com/defunkt/resque/contributing
804
+ [cb]: http://wiki.github.com/defunkt/resque/contributing
data/deps.rip CHANGED
@@ -3,4 +3,5 @@ git://github.com/brianmario/yajl-ruby.git 0.6.3
3
3
  git://github.com/sinatra/sinatra.git 0.9.4
4
4
  git://github.com/rack/rack.git 1.0
5
5
  git://github.com/quirkey/vegas.git v0.1.2
6
+ git://github.com/brynary/rack-test.git v0.5.3
6
7
  rake
@@ -1,3 +1,8 @@
1
1
  $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
2
  require 'resque/tasks'
3
3
  require 'job'
4
+
5
+ desc "Start the demo using `rackup`"
6
+ task :start do
7
+ exec "rackup config.ru"
8
+ end
@@ -0,0 +1,6 @@
1
+ check process resque_worker_QUEUE
2
+ with pidfile /data/APP_NAME/current/tmp/pids/resque_worker_QUEUE.pid
3
+ start program = "/bin/sh -c 'cd /data/APP_NAME/current; RAILS_ENV=production QUEUE=queue_name VERBOSE=1 nohup rake resque:work &> log/resque_worker_QUEUE.log && echo $! > tmp/pids/resque_worker_QUEUE.pid'" as uid deploy and gid deploy
4
+ stop program = "/bin/sh -c 'cd /data/APP_NAME/current && kill -s QUIT `cat tmp/pids/resque_worker_QUEUE.pid` && rm -f tmp/pids/resque_worker_QUEUE.pid; exit 0;'"
5
+ if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory?
6
+ group resque_workers
@@ -59,5 +59,8 @@ module Resque
59
59
  backend.clear
60
60
  end
61
61
 
62
+ def self.requeue(index)
63
+ backend.requeue(index)
64
+ end
62
65
  end
63
66
  end
@@ -48,6 +48,9 @@ module Resque
48
48
  # Clear all failure objects
49
49
  def self.clear
50
50
  end
51
+
52
+ def self.requeue(index)
53
+ end
51
54
 
52
55
  # Logging!
53
56
  def log(message)
@@ -8,6 +8,8 @@ module Resque
8
8
  #
9
9
  # To use it, put this code in an initializer, Rake task, or wherever:
10
10
  #
11
+ # require 'resque/failure/hoptoad'
12
+ #
11
13
  # Resque::Failure::Hoptoad.configure do |config|
12
14
  # config.api_key = 'blah'
13
15
  # config.secure = true
@@ -7,6 +7,7 @@ module Resque
7
7
  data = {
8
8
  :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S"),
9
9
  :payload => payload,
10
+ :exception => exception.class.to_s,
10
11
  :error => exception.to_s,
11
12
  :backtrace => exception.backtrace,
12
13
  :worker => worker.to_s,
@@ -28,6 +29,12 @@ module Resque
28
29
  Resque.redis.del(:failed)
29
30
  end
30
31
 
32
+ def self.requeue(index)
33
+ item = all(index)
34
+ item['retried_at'] = Time.now.strftime("%Y/%m/%d %H:%M:%S")
35
+ Resque.redis.lset(:failed, index, Resque.encode(item))
36
+ Job.create(item['queue'], item['payload']['class'], *item['payload']['args'])
37
+ end
31
38
  end
32
39
  end
33
40
  end
@@ -124,6 +124,11 @@ module Resque
124
124
  show page
125
125
  end
126
126
  end
127
+
128
+ post "/queues/:id/remove" do
129
+ Resque.remove_queue(params[:id])
130
+ redirect u('queues')
131
+ end
127
132
 
128
133
  %w( overview workers ).each do |page|
129
134
  get "/#{page}.poll" do
@@ -145,6 +150,11 @@ module Resque
145
150
  Resque::Failure.clear
146
151
  redirect u('failed')
147
152
  end
153
+
154
+ get "/failed/requeue/:index" do
155
+ Resque::Failure.requeue(params[:index])
156
+ redirect u('failed')
157
+ end
148
158
 
149
159
  get "/stats" do
150
160
  redirect url("/stats/resque")
@@ -8,6 +8,8 @@ body { padding:0; margin:0; }
8
8
  .header ul li a:hover { background:#333;}
9
9
  .header ul li.current a { background:#ce1212; font-weight:bold; color:#fff;}
10
10
 
11
+ .header .namespace { position: absolute; right: 75px; top: 10px; color: #7A7A7A; }
12
+
11
13
  .subnav { padding:2px 5% 7px 5%; background:#ce1212; font-size:90%;}
12
14
  .subnav li { display:inline;}
13
15
  .subnav li a { color:#fff; text-decoration:none; margin-right:10px; display:inline-block; background:#dd5b5b; padding:5px; -webkit-border-radius:3px; -moz-border-radius:3px;}
@@ -65,6 +67,7 @@ body { padding:0; margin:0; }
65
67
  #main ul.failed li {background:-webkit-gradient(linear, left top, left bottom, from(#efefef), to(#fff)) #efefef; margin-top:10px; padding:10px; overflow:hidden; -webkit-border-radius:5px; border:1px solid #ccc; }
66
68
  #main ul.failed li dl dt {font-size:80%; color:#999; width:60px; float:left; padding-top:1px; text-align:right;}
67
69
  #main ul.failed li dl dd {margin-bottom:10px; margin-left:70px;}
70
+ #main ul.failed li dl dd .retry { float: right; }
68
71
  #main ul.failed li dl dd code, #main ul.failed li dl dd pre { font-family:Monaco, "Courier New", monospace; font-size:90%;}
69
72
  #main ul.failed li dl dd.error a {font-family:Monaco, "Courier New", monospace; font-size:90%; }
70
73
  #main ul.failed li dl dd.error pre { margin-top:3px; line-height:1.3;}
@@ -73,4 +76,4 @@ body { padding:0; margin:0; }
73
76
  #main p.pagination a.less { float:left;}
74
77
  #main p.pagination a.more { float:right;}
75
78
 
76
- #main form.clear-failed {float:right; margin-top:-10px;}
79
+ #main form {float:right; margin-top:-10px;}
@@ -0,0 +1,19 @@
1
+ require 'rack/test'
2
+ require 'resque/server'
3
+
4
+ module Resque
5
+ module TestHelper
6
+ class Test::Unit::TestCase
7
+ include Rack::Test::Methods
8
+ def app
9
+ Resque::Server.new
10
+ end
11
+
12
+ def self.should_respond_with_success
13
+ test "should respond with success" do
14
+ assert last_response.ok?
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,6 @@
1
1
  <%start = params[:start].to_i %>
2
2
  <%failed = Resque::Failure.all(start, 20)%>
3
+ <% index = 0 %>
3
4
 
4
5
  <h1>Failed Jobs</h1>
5
6
  <%unless failed.empty?%>
@@ -12,18 +13,30 @@
12
13
 
13
14
  <ul class='failed'>
14
15
  <%for job in failed%>
16
+ <% index += 1 %>
15
17
  <li>
16
18
  <dl>
17
19
  <dt>Worker</dt>
18
- <dd><a href="<%= url(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= job['failed_at'] %></span></b></dd>
20
+ <dd>
21
+ <a href="<%= url(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= job['failed_at'] %></span></b>
22
+ <div class='retry'>
23
+ <% if job['retried_at'] %>
24
+ Retried <b><span class="time"><%= job['retried_at'] %></span></b>
25
+ <% else %>
26
+ <a href="<%= u "failed/requeue/#{start + index - 1}" %>">Retry</a>
27
+ <% end %>
28
+ </div>
29
+ </dd>
19
30
  <dt>Class</dt>
20
31
  <dd><code><%= job['payload']['class'] %></code></dd>
21
32
  <dt>Arguments</dt>
22
33
  <dd><pre><%=h show_args(job['payload']['args']) %></pre></dd>
34
+ <dt>Exception</td>
35
+ <dd><code><%= job['exception'] %></code></dd>
23
36
  <dt>Error</dt>
24
37
  <dd class='error'>
25
38
  <a href="#" class="backtrace"><%= h(job['error']) %></a>
26
- <pre style='display:none'><%=h job['backtrace'].join("\n") %></pre>
39
+ <pre style='display:none'><%=h job['backtrace'].join("\n") %></pre>
27
40
  </dd>
28
41
  </dl>
29
42
  <div class='r'>
@@ -1,11 +1,12 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
+ <meta charset="utf-8" />
4
5
  <title>Resque.</title>
5
6
  <link href="<%=u 'reset.css' %>" media="screen" rel="stylesheet" type="text/css">
6
7
  <link href="<%=u 'style.css' %>" media="screen" rel="stylesheet" type="text/css">
7
- <script src="<%=u 'jquery-1.3.2.min.js' %>" type="text/javascript"</script>
8
- <script src="<%=u 'jquery.relatize_date.js' %>" type="text/javascript"</script>
8
+ <script src="<%=u 'jquery-1.3.2.min.js' %>" type="text/javascript"></script>
9
+ <script src="<%=u 'jquery.relatize_date.js' %>" type="text/javascript"></script>
9
10
  <script src="<%=u 'ranger.js' %>" type="text/javascript"></script>
10
11
  </head>
11
12
  <body>
@@ -15,8 +16,13 @@
15
16
  <%= tab tab_name %>
16
17
  <% end %>
17
18
  </ul>
19
+ <% if Resque.redis.namespace != :resque %>
20
+ <abbr class="namespace" title="Resque's Redis Namespace">
21
+ <%= Resque.redis.namespace %>
22
+ </abbr>
23
+ <% end %>
18
24
  </div>
19
-
25
+
20
26
  <% if @subtabs %>
21
27
  <ul class='subnav'>
22
28
  <% for subtab in @subtabs %>
@@ -24,14 +30,14 @@
24
30
  <% end %>
25
31
  </ul>
26
32
  <% end %>
27
-
33
+
28
34
  <div id="main">
29
35
  <%= yield %>
30
36
  </div>
31
37
 
32
38
  <div id="footer">
33
39
  <p>Powered by <a href="http://github.com/defunkt/resque">Resque</a> v<%=Resque::Version%></p>
34
- <p>Connected to Redis on <%=Resque.redis.server%></p>
40
+ <p>Connected to Redis namespace <%= Resque.redis.namespace %> on <%=Resque.redis.server%></p>
35
41
  </div>
36
42
 
37
43
  </body>
@@ -3,6 +3,9 @@
3
3
  <% if queue = params[:id] %>
4
4
 
5
5
  <h1>Pending jobs on <span class='hl'><%= queue %></span></h1>
6
+ <form method="POST" action="<%=u "/queues/#{queue}/remove" %>" class='remove-queue'>
7
+ <input type='submit' name='' value='Remove Queue' />
8
+ </form>
6
9
  <p class='sub'>Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = resque.size(queue)%></b> jobs</p>
7
10
  <table class='jobs'>
8
11
  <tr>
@@ -18,7 +18,7 @@
18
18
  <% host, pid, queues = worker.to_s.split(':') %>
19
19
  <td><%= host %></td>
20
20
  <td><%= pid %></td>
21
- <td><span class="time"><%= worker.started %></a></td>
21
+ <td><span class="time"><%= worker.started %></span></td>
22
22
  <td class='queues'><%= queues.split(',').map { |q| '<a class="queue-tag" href="' + u("/queues/#{q}") + '">' + q + '</a>'}.join('') %></td>
23
23
  <td><%= worker.processed %></td>
24
24
  <td><%= worker.failed %></td>
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = '1.6.0'
2
+ Version = '1.6.1'
3
3
  end
@@ -322,6 +322,7 @@ module Resque
322
322
  # Unregisters ourself as a worker. Useful when shutting down.
323
323
  def unregister_worker
324
324
  redis.srem(:workers, self)
325
+ redis.del("worker:#{self}")
325
326
  redis.del("worker:#{self}:started")
326
327
 
327
328
  Stat.clear("processed:#{self}")
@@ -1,20 +1,28 @@
1
1
  # Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
2
2
  require 'fileutils'
3
3
  require 'open-uri'
4
+ require 'pathname'
4
5
 
5
6
  class RedisRunner
6
7
 
7
- def self.redisdir
8
- "/tmp/redis/"
8
+ def self.redis_dir
9
+ @redis_dir ||= if ENV['PREFIX']
10
+ Pathname.new(ENV['PREFIX'])
11
+ else
12
+ Pathname.new(`which redis-server`) + '..' + '..'
13
+ end
9
14
  end
10
15
 
11
- def self.redisconfdir
12
- server_dir = File.dirname(`which redis-server`)
13
- conf_file = "#{server_dir}/../etc/redis.conf"
14
- unless File.exists? conf_file
15
- conf_file = "#{server_dir}/../../etc/redis.conf"
16
- end
17
- conf_file
16
+ def self.bin_dir
17
+ redis_dir + 'bin'
18
+ end
19
+
20
+ def self.config
21
+ @config ||= if File.exists?(redis_dir + 'etc/redis.conf')
22
+ redis_dir + 'etc/redis.conf'
23
+ else
24
+ redis_dir + '../etc/redis.conf'
25
+ end
18
26
  end
19
27
 
20
28
  def self.dtach_socket
@@ -29,12 +37,12 @@ class RedisRunner
29
37
  def self.start
30
38
  puts 'Detach with Ctrl+\ Re-attach with rake redis:attach'
31
39
  sleep 1
32
- command = "dtach -A #{dtach_socket} redis-server #{redisconfdir}"
40
+ command = "#{bin_dir}/dtach -A #{dtach_socket} #{bin_dir}/redis-server #{config}"
33
41
  sh command
34
42
  end
35
43
 
36
44
  def self.attach
37
- exec "dtach -a #{dtach_socket}"
45
+ exec "#{bin_dir}/dtach -a #{dtach_socket}"
38
46
  end
39
47
 
40
48
  def self.stop
@@ -73,31 +81,39 @@ namespace :redis do
73
81
 
74
82
  desc 'Install the latest verison of Redis from Github (requires git, duh)'
75
83
  task :install => [:about, :download, :make] do
76
- ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = '/usr/bin'
84
+ bin_dir = '/usr/bin'
85
+ conf_dir = '/etc'
86
+
87
+ if ENV['PREFIX']
88
+ bin_dir = "#{ENV['PREFIX']}/bin"
89
+ sh "mkdir -p #{bin_dir}" unless File.exists?("#{bin_dir}")
90
+
91
+ conf_dir = "#{ENV['PREFIX']}/etc"
92
+ sh "mkdir -p #{conf_dir}" unless File.exists?("#{conf_dir}")
93
+ end
94
+
77
95
  %w(redis-benchmark redis-cli redis-server).each do |bin|
78
96
  sh "cp /tmp/redis/#{bin} #{bin_dir}"
79
97
  end
80
98
 
81
99
  puts "Installed redis-benchmark, redis-cli and redis-server to #{bin_dir}"
82
100
 
83
- ENV['PREFIX'] and conf_dir = "#{ENV['PREFIX']}/etc" or conf_dir = '/etc'
84
101
  unless File.exists?("#{conf_dir}/redis.conf")
85
- sh "mkdir #{conf_dir}" unless File.exists?("#{conf_dir}")
86
102
  sh "cp /tmp/redis/redis.conf #{conf_dir}/redis.conf"
87
103
  puts "Installed redis.conf to #{conf_dir} \n You should look at this file!"
88
104
  end
89
105
  end
90
106
 
91
107
  task :make do
92
- sh "cd #{RedisRunner.redisdir} && make clean"
93
- sh "cd #{RedisRunner.redisdir} && make"
108
+ sh "cd /tmp/redis && make clean"
109
+ sh "cd /tmp/redis && make"
94
110
  end
95
111
 
96
112
  desc "Download package"
97
113
  task :download do
98
- sh 'rm -rf /tmp/redis/' if File.exists?("#{RedisRunner.redisdir}/.svn")
99
- sh 'git clone git://github.com/antirez/redis.git /tmp/redis' unless File.exists?(RedisRunner.redisdir)
100
- sh "cd #{RedisRunner.redisdir} && git pull" if File.exists?("#{RedisRunner.redisdir}/.git")
114
+ sh 'rm -rf /tmp/redis/' if File.exists?("/tmp/redis/.svn")
115
+ sh 'git clone git://github.com/antirez/redis.git /tmp/redis' unless File.exists?('/tmp/redis')
116
+ sh "cd /tmp/redis && git pull" if File.exists?("/tmp/redis/.git")
101
117
  end
102
118
 
103
119
  end
@@ -110,9 +126,24 @@ namespace :dtach do
110
126
  end
111
127
 
112
128
  desc 'Install dtach 0.8 from source'
113
- task :install => [:about] do
129
+ task :install => [:about, :download, :make] do
130
+
131
+ bin_dir = "/usr/bin"
132
+
133
+ if ENV['PREFIX']
134
+ bin_dir = "#{ENV['PREFIX']}/bin"
135
+ sh "mkdir -p #{bin_dir}" unless File.exists?("#{bin_dir}")
136
+ end
137
+
138
+ sh "cp /tmp/dtach-0.8/dtach #{bin_dir}"
139
+ end
140
+
141
+ task :make do
142
+ sh 'cd /tmp/dtach-0.8/ && ./configure && make'
143
+ end
114
144
 
115
- Dir.chdir('/tmp/')
145
+ desc "Download package"
146
+ task :download do
116
147
  unless File.exists?('/tmp/dtach-0.8.tar.gz')
117
148
  require 'net/http'
118
149
 
@@ -121,15 +152,8 @@ namespace :dtach do
121
152
  end
122
153
 
123
154
  unless File.directory?('/tmp/dtach-0.8')
124
- system('tar xzf dtach-0.8.tar.gz')
155
+ sh 'cd /tmp && tar xzf dtach-0.8.tar.gz'
125
156
  end
126
-
127
- ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = "/usr/bin"
128
- Dir.chdir('/tmp/dtach-0.8/')
129
- sh 'cd /tmp/dtach-0.8/ && ./configure && make'
130
- sh "cp /tmp/dtach-0.8/dtach #{bin_dir}"
131
-
132
- puts "Dtach successfully installed to #{bin_dir}"
133
157
  end
134
158
  end
135
159
 
@@ -0,0 +1,54 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require 'resque/server/test_helper'
3
+
4
+ # Root path test
5
+ context "on GET to /" do
6
+ setup { get "/" }
7
+
8
+ test "redirect to overview" do
9
+ follow_redirect!
10
+ end
11
+ end
12
+
13
+ # Global overview
14
+ context "on GET to /overview" do
15
+ setup { get "/overview" }
16
+
17
+ test "should at least display 'queues'" do
18
+ assert last_response.body.include?('Queues')
19
+ end
20
+ end
21
+
22
+ # Working jobs
23
+ context "on GET to /working" do
24
+ setup { get "/working" }
25
+
26
+ should_respond_with_success
27
+ end
28
+
29
+ # Failed
30
+ context "on GET to /failed" do
31
+ setup { get "/failed" }
32
+
33
+ should_respond_with_success
34
+ end
35
+
36
+ # Stats
37
+ context "on GET to /stats/resque" do
38
+ setup { get "/stats/resque" }
39
+
40
+ should_respond_with_success
41
+ end
42
+
43
+ context "on GET to /stats/redis" do
44
+ setup { get "/stats/redis" }
45
+
46
+ should_respond_with_success
47
+ end
48
+
49
+ context "on GET to /stats/resque" do
50
+ setup { get "/stats/keys" }
51
+
52
+ should_respond_with_success
53
+ end
54
+
@@ -94,3 +94,9 @@ class GoodJob
94
94
  "Good job, #{name}"
95
95
  end
96
96
  end
97
+
98
+ class BadJobWithSyntaxError
99
+ def self.perform
100
+ raise SyntaxError, "Extra Bad job!"
101
+ end
102
+ end
@@ -17,6 +17,13 @@ context "Resque::Worker" do
17
17
  @worker.work(0)
18
18
  assert_equal 1, Resque::Failure.count
19
19
  end
20
+
21
+ test "failed jobs report excpetion and message" do
22
+ Resque::Job.create(:jobs, BadJobWithSyntaxError)
23
+ @worker.work(0)
24
+ assert_equal('SyntaxError', Resque::Failure.all['exception'])
25
+ assert_equal('Extra Bad job!', Resque::Failure.all['error'])
26
+ end
20
27
 
21
28
  test "can peek at failed jobs" do
22
29
  10.times { Resque::Job.create(:jobs, BadJob) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-09 00:00:00 -08:00
12
+ date: 2010-03-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -93,6 +93,7 @@ files:
93
93
  - examples/god/resque.god
94
94
  - examples/god/stale.god
95
95
  - examples/instance.rb
96
+ - examples/monit/resque.monit
96
97
  - examples/simple.rb
97
98
  - init.rb
98
99
  - lib/resque.rb
@@ -113,6 +114,7 @@ files:
113
114
  - lib/resque/server/public/reset.css
114
115
  - lib/resque/server/public/style.css
115
116
  - lib/resque/server/public/working.png
117
+ - lib/resque/server/test_helper.rb
116
118
  - lib/resque/server/views/error.erb
117
119
  - lib/resque/server/views/failed.erb
118
120
  - lib/resque/server/views/key_sets.erb
@@ -131,6 +133,7 @@ files:
131
133
  - tasks/redis.rake
132
134
  - tasks/resque.rake
133
135
  - test/redis-test.conf
136
+ - test/resque-web_test.rb
134
137
  - test/resque_test.rb
135
138
  - test/test_helper.rb
136
139
  - test/worker_test.rb
@@ -163,6 +166,7 @@ signing_key:
163
166
  specification_version: 3
164
167
  summary: ""
165
168
  test_files:
169
+ - test/resque-web_test.rb
166
170
  - test/resque_test.rb
167
171
  - test/test_helper.rb
168
172
  - test/worker_test.rb