sidekiq-prioritized_queues 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 472c6683a50393966af89094f5c98d32d285f7c8
4
- data.tar.gz: 86a3a16e91c457682e6e7d95980ed29fac348dbf
3
+ metadata.gz: 25428b7ef28cc56cad4948c15a8c3168382fd1a5
4
+ data.tar.gz: 8ff665f5fa5cb9146d2408e3778d48e749250467
5
5
  SHA512:
6
- metadata.gz: 0b2dee492c651c8c3db1ad0e73f0904cb4ee1b4f337c50241ab3f593fd73f560fb48b20e77eb6253314bc3d1ddaf28b7cc84728eae48227b7aac419f1b6d7ea1
7
- data.tar.gz: 2bd344b5c99597085746c3e66563c4c4bc7f458d48ec15c9958d519bf6dbf80952896b9656f77d7120c90a4bbc2b7984e931fd938e3c014430da7b1ae02ae610
6
+ metadata.gz: fed0c40fc2ae7815a16f742493ed872fdaf5af7e5e988deb2020759758db341ca38d1b420b5d3b45c853c53d54ec87919f21730cb4e3674212de07e630f02982
7
+ data.tar.gz: 3ce97f29f2866d6fa2632522ead3500dab881b13084c3f79959b5e83d00b68fb980e0d4807ff8e32d4ebb29145b8dd3180613bb998d9518da744a61f69c95d81
data/README.md CHANGED
@@ -49,6 +49,8 @@ class SatisfyOrderWorker
49
49
  end
50
50
  ```
51
51
 
52
+ ### Dynamic
53
+
52
54
  For workers on the same queue, the `priority` option can take a `Proc` which will be given the arguments the job was queued with. As an example:
53
55
 
54
56
  ```ruby
@@ -12,6 +12,7 @@ module Sidekiq
12
12
  msg['priority'] = case priority
13
13
  when Proc then priority.call(*msg['args'])
14
14
  when String then priority.to_i
15
+ when Fixnum then priority
15
16
  else Time.now.to_f
16
17
  end
17
18
 
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module PrioritizedQueues
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -17,6 +17,14 @@ module Sidekiq
17
17
 
18
18
  assert_equal 100, job['priority']
19
19
  end
20
+
21
+ it 'should pick the priority up from fixed values' do
22
+ MockWorkerFixedPrio.perform_async(10)
23
+ json = Sidekiq.redis { |c| c.zrange('queue:default', 0, 0) }.first
24
+ job = Sidekiq.load_json(json)
25
+
26
+ assert_equal 2, job['priority']
27
+ end
20
28
  end
21
29
  end
22
30
  end
@@ -16,3 +16,11 @@ class MockWorker
16
16
  def perform(arg)
17
17
  end
18
18
  end
19
+
20
+ class MockWorkerFixedPrio
21
+ include Sidekiq::Worker
22
+ sidekiq_options priority: 2
23
+
24
+ def perform(arg)
25
+ end
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-prioritized_queues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andre Medeiros
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq