resque 1.12.0 → 1.13.0

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.

data/HISTORY.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 1.13.0 (2011-02-07)
2
+
3
+ * Depend on redis-namespace >= 0.10
4
+ * README tweaks
5
+ * Use thread_safe option when setting redis url
6
+ * Bugfix: worker pruning
7
+
1
8
  ## 1.12.0 (2011-02-03)
2
9
 
3
10
  * Added pidfile writing from `rake resque:work`
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009, 2010 Chris Wanstrath
1
+ Copyright (c) Chris Wanstrath
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -535,7 +535,7 @@ together. But, it's not that hard.
535
535
  Resque Dependencies
536
536
  -------------------
537
537
 
538
- gem install redis redis-namespace yajl-ruby
538
+ gem install redis redis-namespace yajl-ruby vegas sinatra
539
539
 
540
540
  If you cannot install `yajl-ruby` (JRuby?), you can install the `json`
541
541
  gem and Resque will use it instead.
@@ -759,7 +759,7 @@ Once you've made your great commits:
759
759
  1. [Fork][1] Resque
760
760
  2. Create a topic branch - `git checkout -b my_branch`
761
761
  3. Push to your branch - `git push origin my_branch`
762
- 4. Create an [Issue][2] with a link to your branch
762
+ 4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch
763
763
  5. That's it!
764
764
 
765
765
  You might want to checkout our [Contributing][cb] wiki page for information
data/bin/resque CHANGED
@@ -1,7 +1,40 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ begin
5
+ require 'redis-namespace'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'redis-namespace'
9
+ end
4
10
  require 'resque'
11
+ require 'optparse'
12
+
13
+ parser = OptionParser.new do |opts|
14
+ opts.banner = "Usage: resque [options] COMMAND"
15
+
16
+ opts.separator ""
17
+ opts.separator "Options:"
18
+
19
+ opts.on("-r", "--redis [HOST:PORT]", "Redis connection string") do |host|
20
+ Resque.redis = host
21
+ end
22
+
23
+ opts.on("-N", "--namespace [NAMESPACE]", "Redis namespace") do |namespace|
24
+ Resque.redis.namespace = namespace
25
+ end
26
+
27
+ opts.on("-h", "--help", "Show this message") do
28
+ puts opts
29
+ exit
30
+ end
31
+
32
+ opts.separator ""
33
+ opts.separator "Commands:"
34
+ opts.separator " remove WORKER Removes a worker"
35
+ opts.separator " kill WORKER Kills a worker"
36
+ opts.separator " list Lists known workers"
37
+ end
5
38
 
6
39
  def kill(worker)
7
40
  abort "** resque kill WORKER_ID" if worker.nil?
@@ -34,11 +67,7 @@ def list
34
67
  end
35
68
  end
36
69
 
37
- if (i = ARGV.index('-r')) && ARGV[i+1]
38
- Resque.redis = ARGV[i+1]
39
- ARGV.delete_at(i)
40
- ARGV.delete_at(i+1)
41
- end
70
+ parser.parse!
42
71
 
43
72
  case ARGV[0]
44
73
  when 'kill'
@@ -48,10 +77,5 @@ when 'remove'
48
77
  when 'list'
49
78
  list
50
79
  else
51
- puts "Usage: resque [-r redis_host:redis_port] COMMAND [option]"
52
- puts
53
- puts "Commands:"
54
- puts " remove WORKER Removes a worker"
55
- puts " kill WORKER Kills a worker"
56
- puts " list Lists known workers"
80
+ puts parser.help
57
81
  end
data/lib/resque.rb CHANGED
@@ -33,7 +33,7 @@ module Resque
33
33
  def redis=(server)
34
34
  if server.respond_to? :split
35
35
  if server =~ /redis\:\/\//
36
- redis = Redis.connect(:url => server)
36
+ redis = Redis.connect(:url => server, :thread_safe => true)
37
37
  else
38
38
  server, namespace = server.split('/', 2)
39
39
  host, port, db = server.split(':')
data/lib/resque/errors.rb CHANGED
@@ -4,7 +4,7 @@ module Resque
4
4
 
5
5
  # Raised when trying to create a job without a class
6
6
  class NoClassError < RuntimeError; end
7
-
7
+
8
8
  # Raised when a worker was killed while processing a job.
9
9
  class DirtyExit < RuntimeError; end
10
10
  end
@@ -53,12 +53,12 @@ module Resque
53
53
  def self.url
54
54
  backend.url
55
55
  end
56
-
56
+
57
57
  # Clear all failure jobs
58
58
  def self.clear
59
59
  backend.clear
60
60
  end
61
-
61
+
62
62
  def self.requeue(index)
63
63
  backend.requeue(index)
64
64
  end
@@ -5,15 +5,15 @@ module Resque
5
5
  module TestHelper
6
6
  class Test::Unit::TestCase
7
7
  include Rack::Test::Methods
8
- def app
8
+ def app
9
9
  Resque::Server.new
10
10
  end
11
11
 
12
12
  def self.should_respond_with_success
13
13
  test "should respond with success" do
14
14
  assert last_response.ok?, last_response.errors
15
- end
16
- end
15
+ end
16
+ end
17
17
  end
18
18
  end
19
19
  end
@@ -4,7 +4,6 @@
4
4
  Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = redis_get_size(key) %></b>
5
5
  </p>
6
6
 
7
-
8
7
  <h1>Key "<%= key %>" is a <%= resque.redis.type key %></h1>
9
8
  <table>
10
9
  <% for row in redis_get_value_as_array(key, start) %>
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.12.0'
2
+ Version = VERSION = '1.13.0'
3
3
  end
data/lib/resque/worker.rb CHANGED
@@ -470,7 +470,7 @@ module Resque
470
470
  # Returns an array of string pids of all the other workers on this
471
471
  # machine. Useful when pruning dead workers on startup.
472
472
  def worker_pids
473
- `ps -A -o pid,command | grep [r]esque | grep -i "resque-web"`.split("\n").map do |line|
473
+ `ps -A -o pid,command | grep [r]esque | grep -v "resque-web"`.split("\n").map do |line|
474
474
  line.split(' ')[0]
475
475
  end
476
476
  end
@@ -320,4 +320,3 @@ context "Resque::Job all hooks" do
320
320
  ]
321
321
  end
322
322
  end
323
-
@@ -51,4 +51,3 @@ context "on GET to /stats/resque" do
51
51
 
52
52
  should_respond_with_success
53
53
  end
54
-
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 35
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 12
8
+ - 13
9
9
  - 0
10
- version: 1.12.0
10
+ version: 1.13.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Wanstrath
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-03 00:00:00 -08:00
18
+ date: 2011-02-07 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,14 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 63
29
+ hash: 55
30
30
  segments:
31
31
  - 0
32
- - 8
32
+ - 10
33
33
  - 0
34
- version: 0.8.0
34
+ version: 0.10.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency