@@ -26,6 +26,20 @@ def queue_depth queuename
26
26
27
27
DEFAULT_QUEUE_DEPTH = 0
28
28
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
+
29
43
return true if @queues . include? '*' # workers with QUEUES=* are special and are not subject to queue depth setting
30
44
max = DEFAULT_QUEUE_DEPTH
31
45
unless ENV [ "RESQUE_QUEUE_DEPTH" ] . nil? || ENV [ "RESQUE_QUEUE_DEPTH" ] == ""
@@ -40,18 +54,13 @@ def should_work_on_queue? queuename
40
54
41
55
def reserve_with_round_robin
42
56
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
-
53
57
qs = rotated_queues
54
58
qs . each do |queue |
59
+
60
+ if queue . to_s . index ( "replay" )
61
+
62
+ end
63
+
55
64
log! "Checking #{ queue } "
56
65
if should_work_on_queue? ( queue ) && job = Resque ::Job . reserve ( queue )
57
66
log! "Found job on #{ queue } "
0 commit comments