softwear-lib 1.7.20 → 1.8.0

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: ba6e53c8b496ff26415d9abeb5914d10b4a58104
4
- data.tar.gz: 058aa264d5c2565c150ed9535b514177166c3f14
3
+ metadata.gz: 4ba997cdcca4c738dc0e92953c7a3193541fd256
4
+ data.tar.gz: de8293816825a71c8864c9539a9df853c15017d9
5
5
  SHA512:
6
- metadata.gz: 0353b213399ea2ebd26a42ebbb01221e2c1db5566d2cf155724acb9f3c9253335b816fd8a38839824e118f707f9d54636294f4f2fc3932946300e0030904458a
7
- data.tar.gz: 31c446f380aebe301afb39b446f71e56d32b87a634f500eeb840432ac97538f59fa2c5989d84828042869787fc92d924a3f4bf3800decf72d6516ce0c6a9debb
6
+ metadata.gz: f1b075f5da35bb6d56e9baa1c9e2f271931d02c23cd16b53da3ce5a83ad4b87edc756c977898d58cf3c7d8b36e8e01d663533de15420fd8069583df4c561f019
7
+ data.tar.gz: 444516f41f32cda04746f9b1900ac2b7061cdceca7d89335e8186e1ee2889387b3508009bd3803ce5c6643d040387fff4aa6e7a8f8bd773f04c2732ca09d49c6
@@ -3,6 +3,14 @@ module Softwear
3
3
  module Enqueue
4
4
  extend ActiveSupport::Concern
5
5
 
6
+ class Worker
7
+ include Sidekiq::Worker
8
+
9
+ def perform(model_name, id, method, *args)
10
+ model_name.constantize.find(id).send(method, *args)
11
+ end
12
+ end
13
+
6
14
  module ClassMethods
7
15
  def enqueue(*method_names)
8
16
  if method_names.last.is_a?(Hash)
@@ -22,11 +30,15 @@ module Softwear
22
30
  if Rails.env.production?
23
31
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
24
32
  def self.enqueue_#{method_name}(id, *args)
25
- delay(#{options.inspect}).#{method_name}(id, *args)
33
+ Sidekiq::Client.push(
34
+ 'class' => ::Softwear::Lib::Enqueue::Worker,
35
+ 'args' => [name, id, #{method_name.inspect}] + args,
36
+ 'queue' => #{options[:queue]}
37
+ )
26
38
  end
27
39
 
28
40
  def enqueue_#{method_name}(*args)
29
- self.class.delay(#{options.inspect}).#{method_name}(id, *args)
41
+ self.class.enqueue_#{method_name}(*args)
30
42
  end
31
43
  RUBY
32
44
  else
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Lib
3
- VERSION = "1.7.20"
3
+ VERSION = "1.8.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.20
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler