resque-igo 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/resque/job.rb CHANGED
@@ -70,6 +70,10 @@ module Resque
70
70
  raise QueueError.new 'trying to insert a delayed job into a non-delayed queue'
71
71
  end
72
72
  end
73
+
74
+ #is it a hydra job?
75
+ heads = klass.instance_variable_get(:@hydra)
76
+ queue = (queue.to_s + rand(heads).to_s).to_sym if heads
73
77
 
74
78
  ret = Resque.push(queue, item)
75
79
  Plugin.after_enqueue_hooks(klass).each do |hook|
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.1.4'
2
+ Version = VERSION = '1.1.5'
3
3
  end
data/test/resque_test.rb CHANGED
@@ -319,7 +319,7 @@ context "Resque" do
319
319
  Resque.bypass_queues = true
320
320
  args = { :delay_until => Time.new+20}
321
321
  foo = Resque.enqueue(DelayedJob, args)
322
- assert(0, Resque.size(:delayed))
322
+ assert_equal(0, Resque.size(:delayed))
323
323
  assert(args[:delay_until] > Time.new)
324
324
  assert(foo =~ /^delayed job executing/)
325
325
  Resque.bypass_queues = false
@@ -338,4 +338,14 @@ context "Resque" do
338
338
  Resque.enqueue(MistargetedDelayedJob, dargs)
339
339
  end
340
340
  end
341
+
342
+ test "hydra works" do
343
+ 20.times do
344
+ Resque.enqueue(HydraJob, { :one => 'one'})
345
+ end
346
+ assert_equal(0, Resque.size(:hydra))
347
+ assert_equal(20, Resque.size(:hydra1)+Resque.size(:hydra0))
348
+ assert(0 != Resque.size(:hydra1))
349
+ assert(0 != Resque.size(:hydra0))
350
+ end
341
351
  end
data/test/test_helper.rb CHANGED
@@ -123,6 +123,11 @@ class NonDelayedJob
123
123
  @queue = :delayed
124
124
  end
125
125
 
126
+ class HydraJob
127
+ @queue = :hydra
128
+ @hydra = 2
129
+ end
130
+
126
131
  #some redgreen fun
127
132
  # -*- coding: utf-8 -*-
128
133
  begin
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-igo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 4
10
- version: 1.1.4
9
+ - 5
10
+ version: 1.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan D Acuff
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-03 00:00:00 -04:00
18
+ date: 2010-12-01 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency