Skip to content

Commit 874045f

Browse files
committed
Merge branch 'master' into 2.0
Conflicts: HISTORY.md
2 parents 6cb3bde + 25473f2 commit 874045f

File tree

11 files changed

+60
-31
lines changed

11 files changed

+60
-31
lines changed

HISTORY.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,41 @@
22

33
* Resque now uses Unix Epoch Timestamps exclusively.
44

5+
## 1.9.4 (2010-06-14)
6+
7+
* Bugfix: Multiple failure backend gets exception information when created
8+
9+
## 1.9.3 (2010-06-14)
10+
11+
* Bugfix: Resque#queues always returns an array
12+
13+
## 1.9.2 (2010-06-13)
14+
15+
* Bugfix: Worker.all returning nil fix
16+
* Bugfix: Make ps -o more cross platform friendly
17+
18+
## 1.9.1 (2010-06-04)
19+
20+
* Less strict JSON dependency
21+
* Included HISTORY.md in gem
22+
23+
## 1.9.0 (2010-06-04)
24+
25+
* Redis 2 support
26+
* Depend on redis-namespace 0.5.0
27+
* Added Resque::VERSION constant (alias of Resque::Version)
28+
* Bugfix: Specify JSON dependency
29+
* Bugfix: Hoptoad plugin now works on 1.9
30+
31+
## 1.8.5 (2010-05-18)
32+
33+
* Bugfix: Be more liberal in which Redis clients we accept.
34+
35+
## 1.8.4 (2010-05-18)
36+
37+
* Try to resolve redis-namespace dependency issue
38+
>>>>>>> master
39+
540
## 1.8.3 (2010-05-17)
641

742
* Depend on redis-rb ~> 1.0.7

lib/resque.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ def redis
4949
self.redis
5050
end
5151

52+
def redis_id
53+
# support 1.x versions of redis-rb
54+
if redis.respond_to?(:server)
55+
redis.server
56+
else
57+
redis.client.id
58+
end
59+
end
60+
5261
# The `before_first_fork` hook will be run in the **parent** process
5362
# only once, before forking to run the first job. Be careful- any
5463
# changes you make will be permanent for the lifespan of the
@@ -100,7 +109,7 @@ def after_fork=(block)
100109
end
101110

102111
def to_s
103-
"Resque Client connected to #{redis.server}"
112+
"Resque Client connected to #{redis_id}"
104113
end
105114

106115

@@ -154,7 +163,7 @@ def list_range(key, start = 0, count = 1)
154163

155164
# Returns an array of all known Resque queues as strings.
156165
def queues
157-
redis.smembers(:queues)
166+
Array(redis.smembers(:queues))
158167
end
159168

160169
# Given a queue name, completely deletes the queue.
@@ -273,7 +282,7 @@ def info
273282
:workers => workers.size.to_i,
274283
:working => working.size,
275284
:failed => Stat[:failed],
276-
:servers => [redis.server],
285+
:servers => [redis_id],
277286
:environment => defined?(RAILS_ENV) ? RAILS_ENV : (ENV['RACK_ENV'] || 'development')
278287
}
279288
end

lib/resque/failure/multiple.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ def self.configure
1414
end
1515

1616
def initialize(*args)
17+
super
1718
@backends = self.class.classes.map {|klass| klass.new(*args)}
1819
end
20+
1921
def save
2022
@backends.each(&:save)
2123
end

lib/resque/server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def show(page, layout = true)
106106
begin
107107
erb page.to_sym, {:layout => layout}, :resque => Resque
108108
rescue Errno::ECONNREFUSED
109-
erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{Resque.redis.server})"
109+
erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{Resque.redis_id})"
110110
end
111111
end
112112

@@ -124,7 +124,7 @@ def show(page, layout = true)
124124
show page
125125
end
126126
end
127-
127+
128128
post "/queues/:id/remove" do
129129
Resque.remove_queue(params[:id])
130130
redirect u('queues')
@@ -150,7 +150,7 @@ def show(page, layout = true)
150150
Resque::Failure.clear
151151
redirect u('failed')
152152
end
153-
153+
154154
get "/failed/requeue/:index" do
155155
Resque::Failure.requeue(params[:index])
156156
if request.xhr?

lib/resque/server/views/layout.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
<div id="footer">
3939
<p>Powered by <a href="http://github.com/defunkt/resque">Resque</a> v<%=Resque::Version%></p>
40-
<p>Connected to Redis namespace <%= Resque.redis.namespace %> on <%=Resque.redis.server%></p>
40+
<p>Connected to Redis namespace <%= Resque.redis.namespace %> on <%=Resque.redis_id%></p>
4141
</div>
4242

4343
</body>

lib/resque/server/views/stats.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<% elsif params[:id] == 'redis' %>
2424

25-
<h1><%= resque.redis.server %></h1>
25+
<h1><%= resque.redis_id %></h1>
2626
<table class='stats'>
2727
<% for key, value in resque.redis.info.to_a.sort_by { |i| i[0].to_s } %>
2828
<tr>

lib/resque/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Resque
2-
Version = '1.8.5'
2+
Version = VERSION = '1.9.4'
33
end

lib/resque/worker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Worker
2424

2525
# Returns an array of all worker objects.
2626
def self.all
27-
redis.smembers(:workers).map { |id| find(id) }
27+
Array(redis.smembers(:workers)).map { |id| find(id) }
2828
end
2929

3030
# Returns an array of all worker objects currently processing
@@ -448,7 +448,7 @@ def hostname
448448
# Returns an array of string pids of all the other workers on this
449449
# machine. Useful when pruning dead workers on startup.
450450
def worker_pids
451-
`ps -A -o pid,command | grep [r]esque`.split("\n").map do |line|
451+
`ps -A -o pid,comm | grep [r]esque`.split("\n").map do |line|
452452
line.split(' ')[0]
453453
end
454454
end

resque.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
1010
s.email = "[email protected]"
1111
s.authors = [ "Chris Wanstrath" ]
1212

13-
s.files = %w( README.markdown Rakefile LICENSE )
13+
s.files = %w( README.markdown Rakefile LICENSE HISTORY.md )
1414
s.files += Dir.glob("lib/**/*")
1515
s.files += Dir.glob("bin/**/*")
1616
s.files += Dir.glob("man/**/*")
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
2424
s.add_dependency "redis-namespace", "~> 0.5.0"
2525
s.add_dependency "vegas", "~> 0.1.2"
2626
s.add_dependency "sinatra", ">= 0.9.2"
27-
s.add_dependency "json", "~> 1.1.3"
27+
s.add_dependency "json", ">= 1.1.0"
2828

2929
s.description = <<description
3030
Resque is a Redis-backed Ruby library for creating background jobs,

test/redis-test.conf

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,3 @@ databases 16
113113
# single TCP packet. Uses a bit more CPU but most of the times it is a win
114114
# in terms of number of queries per second. Use 'yes' if unsure.
115115
glueoutputbuf yes
116-
117-
# Use object sharing. Can save a lot of memory if you have many common
118-
# string in your dataset, but performs lookups against the shared objects
119-
# pool so it uses more CPU and can be a bit slower. Usually it's a good
120-
# idea.
121-
#
122-
# When object sharing is enabled (shareobjects yes) you can use
123-
# shareobjectspoolsize to control the size of the pool used in order to try
124-
# object sharing. A bigger pool size will lead to better sharing capabilities.
125-
# In general you want this value to be at least the double of the number of
126-
# very common strings you have in your dataset.
127-
#
128-
# WARNING: object sharing is experimental, don't enable this feature
129-
# in production before of Redis 1.0-stable. Still please try this feature in
130-
# your development environment so that we can test it better.
131-
shareobjects no
132-
shareobjectspoolsize 1024

0 commit comments

Comments
 (0)