Skip to content

Commit 09b1fdd

Browse files
committed
new hack
1 parent 6fe6c9f commit 09b1fdd

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

lib/resque/plugins/round_robin/round_robin.rb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ def queue_depth queuename
2626

2727
DEFAULT_QUEUE_DEPTH = 0
2828
def should_work_on_queue? queuename
29+
30+
# megahack :(
31+
#
32+
# tried to use an env variable for a less hacky hack, but i dont
33+
# know how to get env variables into the EY resque daemon, and
34+
# Ive been fighting to get this to round-robining system to work
35+
# for five hours now. If you hate this, you can fix it.
36+
#
37+
if !queuename.to_s.index("replay").nil?
38+
if Resque.size("python") > 2
39+
return false
40+
end
41+
end
42+
2943
return true if @queues.include? '*' # workers with QUEUES=* are special and are not subject to queue depth setting
3044
max = DEFAULT_QUEUE_DEPTH
3145
unless ENV["RESQUE_QUEUE_DEPTH"].nil? || ENV["RESQUE_QUEUE_DEPTH"] == ""
@@ -40,18 +54,13 @@ def should_work_on_queue? queuename
4054

4155
def reserve_with_round_robin
4256

43-
# DJs hack: allow this resque process to watch a named queue
44-
# (python), and if that queue has more than a certain number of
45-
# items on it, then we do nothing. This is a big hack to get
46-
# around the lack of round-robining in pyres.
47-
if ENV["RESQUE_DEPENDENT_ON"].present?
48-
if Resque.size(ENV["RESQUE_DEPENDENT_ON"]) > ENV["RESQUE_DEPENDENT_MAX"].to_i
49-
return nil
50-
end
51-
end
52-
5357
qs = rotated_queues
5458
qs.each do |queue|
59+
60+
if queue.to_s.index("replay")
61+
62+
end
63+
5564
log! "Checking #{queue}"
5665
if should_work_on_queue?(queue) && job = Resque::Job.reserve(queue)
5766
log! "Found job on #{queue}"

0 commit comments

Comments
 (0)