Skip to content

Commit 9b4b900

Browse files
John Andrews + Andrew Grieserdefunkt
authored andcommitted
Fix issue with finding worker pids on jruby
- Old pattern returned empty array of worker pids on jruby
1 parent 3bc9244 commit 9b4b900

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/resque/worker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def pid
476476
# Returns an array of string pids of all the other workers on this
477477
# machine. Useful when pruning dead workers on startup.
478478
def worker_pids
479-
`ps -A -o pid,command | grep [r]esque | grep -v "resque-web"`.split("\n").map do |line|
479+
`ps -A -o pid,command | grep resque | grep -v "resque-web"`.split("\n").map do |line|
480480
line.split(' ')[0]
481481
end
482482
end

test/worker_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@
267267
end
268268
end
269269

270+
test "worker_pids returns pids" do
271+
known_workers = @worker.worker_pids
272+
assert !known_workers.empty?
273+
end
274+
270275
test "Processed jobs count" do
271276
@worker.work(0)
272277
assert_equal 1, Resque.info[:processed]

0 commit comments

Comments
 (0)