sidekiq-paquet 0.2.0 → 0.2.2

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: 2a3886887de8e637e18bd9908831371f37ac7ea9
4
- data.tar.gz: c424dee95bc830a67aad1b22581ea8b4924ea4a6
3
+ metadata.gz: 35c556ed0ee47013d0f13561482370c88dcaf3b5
4
+ data.tar.gz: c7022eb0f618b007728cc1413a05d425ceca7935
5
5
  SHA512:
6
- metadata.gz: 57cc001b4f3335cf0b53c712d62bd02f266b502589256b5456aa8d437ca952868f58f239c83deacca4e6b108a86789730feb5d5f0065ae3d50d6613025df3b48
7
- data.tar.gz: 25d88e4e1ebcc4e956838e928575dfb325acbb1312a91309810278143c1d214c9128b285d5c128dab336a729115b6478d161471c86612055f00f662d65072e0d
6
+ metadata.gz: c463d405e10729dc857e4311caa92927f72b559178daabb4ea69858405f9006a2d1f0d09c24aa5bde7e99be78b9fd929f14ca1e5f4da719f7841f82df8294dd8
7
+ data.tar.gz: 847f0252d19512db6f4f3b6ac5832861e58427e92c5c24454b93211c22d2dad3672cf5414972af69e4a257364b3bd417f17adb5e468deeeef78d356a5099c3ae
@@ -8,7 +8,11 @@ module Sidekiq
8
8
 
9
9
  Sidekiq.redis do |conn|
10
10
  conn.multi do
11
- conn.zadd('bundles'.freeze, 0, worker_name, nx: true)
11
+ if Paquet.options[:compatibility_mode]
12
+ conn.zadd('bundles'.freeze, 0, worker_name)
13
+ else
14
+ conn.zadd('bundles'.freeze, 0, worker_name, nx: true)
15
+ end
12
16
  conn.rpush("bundle:#{worker_name}", Sidekiq.dump_json(args))
13
17
  end
14
18
  end
@@ -27,7 +31,7 @@ module Sidekiq
27
31
  items = conn.lrange("bundle:#{worker}", 0, -1)
28
32
  items.map! { |i| Sidekiq.load_json(i) }
29
33
 
30
- items.each_slice(opts.fetch('bundle_size'.freeze, Sidekiq::Paquet.options[:default_bundle_size])) do |vs|
34
+ items.each_slice(opts.fetch('bundle_size'.freeze, Paquet.options[:default_bundle_size])) do |vs|
31
35
  Sidekiq::Client.push(
32
36
  'class' => worker,
33
37
  'queue' => opts['queue'.freeze],
@@ -36,7 +40,7 @@ module Sidekiq
36
40
  end
37
41
 
38
42
  conn.ltrim("bundle:#{worker}", items.size, -1)
39
- conn.zadd('bundles'.freeze, now + min_interval, worker) if min_interval
43
+ conn.zadd('bundles'.freeze, now + min_interval, worker) if !Paquet.options[:compatibility_mode] && min_interval
40
44
  end
41
45
  end
42
46
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Paquet
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
@@ -13,7 +13,8 @@ module Sidekiq
13
13
  default_bundle_size: 100,
14
14
  flush_interval: nil,
15
15
  average_flush_interval: 15,
16
- initial_wait: 10
16
+ initial_wait: 10,
17
+ compatibility_mode: false
17
18
  }
18
19
 
19
20
  def self.options
@@ -24,6 +25,10 @@ module Sidekiq
24
25
  @options = opts
25
26
  end
26
27
 
28
+ def self.compatibility_mode=(v)
29
+ options[:compatibility_mode] = !!v
30
+ end
31
+
27
32
  def self.initial_wait
28
33
  options[:initial_wait] + (5 * rand)
29
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-paquet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ccocchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq