apartment-sidekiq 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +6 -3
- data/apartment-sidekiq.gemspec +1 -1
- data/lib/apartment/sidekiq/railtie.rb +2 -18
- data/lib/apartment/sidekiq/version.rb +1 -1
- data/lib/apartment/sidekiq.rb +21 -2
- metadata +16 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1c111136f6ec3e42bec95d541cfe798a395d7202
|
4
|
+
data.tar.gz: 0d94d71435208148fde0f76aecdfbe70b445fd2c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fb554b2d8cda0abcaf8e6c1d0e2819ca1d8db6d21cf84b772350462d26ed03324ace0c4b359426ba4f72eaad6ae1d12d03eb7155bab9b51da3955f29185381a8
|
7
|
+
data.tar.gz: 7087b2f6a4f30bd407f94a76655a6e7bb3cf44bee9eb5b1c01985944d3f6994bfd9174a88bf2b5293136aa223e61fc77ef03263468317b4edda87c362c501455
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Apartment::Sidekiq
|
2
2
|
|
3
|
-
|
3
|
+
Official Support for Sidekiq with the Apartment Gem.
|
4
4
|
|
5
|
-
|
5
|
+
This gem takes care of storing the current tenant that a job is enqueued within.
|
6
|
+
It will then switch to that tenant for the duration of the job processing.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -20,7 +21,9 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
23
|
-
|
24
|
+
That's it. There's nothing to do. Each job that is queued will get an additional entry
|
25
|
+
storing `Apartment::Database.current` when it is queued. Then when the server pops it,
|
26
|
+
it will run job within an `Apartment::Database.process` block.
|
24
27
|
|
25
28
|
## Contributing
|
26
29
|
|
data/apartment-sidekiq.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["brad@influitive.com"]
|
11
11
|
spec.description = %q{Enable Multi-tenant supported jobs to work with Sidekiq background worker}
|
12
12
|
spec.summary = %q{Sidekiq support for Apartment}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/influitive/apartment-sidekiq"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -1,23 +1,7 @@
|
|
1
1
|
module Apartment::Sidekiq
|
2
2
|
class Railtie < Rails::Railtie
|
3
3
|
initializer "apartment.sidekiq" do
|
4
|
-
|
5
|
-
|
6
|
-
Sidekiq.configure_client do |config|
|
7
|
-
config.client_middleware do |chain|
|
8
|
-
chain.add Apartment::Sidekiq::Middleware::Client
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
Sidekiq.configure_server do |config|
|
13
|
-
config.client_middleware do |chain|
|
14
|
-
chain.add Apartment::Sidekiq::Middleware::Client
|
15
|
-
end
|
16
|
-
|
17
|
-
config.server_middleware do |chain|
|
18
|
-
chain.add Apartment::Sidekiq::Middleware::Server
|
19
|
-
end
|
20
|
-
end
|
4
|
+
Apartment::Sidekiq::Middleware.run
|
21
5
|
end
|
22
6
|
end
|
23
|
-
end
|
7
|
+
end
|
data/lib/apartment/sidekiq.rb
CHANGED
@@ -1,12 +1,31 @@
|
|
1
|
-
require
|
1
|
+
require 'apartment/sidekiq/version'
|
2
|
+
require 'sidekiq'
|
2
3
|
|
3
4
|
module Apartment
|
4
5
|
module Sidekiq
|
5
6
|
module Middleware
|
6
7
|
autoload :Client, 'apartment/sidekiq/middleware/client'
|
7
8
|
autoload :Server, 'apartment/sidekiq/middleware/server'
|
9
|
+
|
10
|
+
def self.run
|
11
|
+
::Sidekiq.configure_client do |config|
|
12
|
+
config.client_middleware do |chain|
|
13
|
+
chain.add Apartment::Sidekiq::Middleware::Client
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
::Sidekiq.configure_server do |config|
|
18
|
+
config.client_middleware do |chain|
|
19
|
+
chain.add Apartment::Sidekiq::Middleware::Client
|
20
|
+
end
|
21
|
+
|
22
|
+
config.server_middleware do |chain|
|
23
|
+
chain.add Apartment::Sidekiq::Middleware::Server
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
8
27
|
end
|
9
28
|
end
|
10
29
|
end
|
11
30
|
|
12
|
-
require 'apartment/sidekiq/railtie' if defined?(Rails)
|
31
|
+
require 'apartment/sidekiq/railtie' if defined?(Rails)
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apartment-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brad Robertson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,65 +27,57 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: minitest
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: apartment
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0.19'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0.19'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: sidekiq
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '2.11'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '2.11'
|
94
83
|
description: Enable Multi-tenant supported jobs to work with Sidekiq background worker
|
@@ -111,36 +100,29 @@ files:
|
|
111
100
|
- lib/apartment/sidekiq/railtie.rb
|
112
101
|
- lib/apartment/sidekiq/version.rb
|
113
102
|
- spec/spec_helper.rb
|
114
|
-
homepage:
|
103
|
+
homepage: https://github.com/influitive/apartment-sidekiq
|
115
104
|
licenses:
|
116
105
|
- MIT
|
106
|
+
metadata: {}
|
117
107
|
post_install_message:
|
118
108
|
rdoc_options: []
|
119
109
|
require_paths:
|
120
110
|
- lib
|
121
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
112
|
requirements:
|
124
|
-
- -
|
113
|
+
- - '>='
|
125
114
|
- !ruby/object:Gem::Version
|
126
115
|
version: '0'
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
hash: -235536360364497139
|
130
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
117
|
requirements:
|
133
|
-
- -
|
118
|
+
- - '>='
|
134
119
|
- !ruby/object:Gem::Version
|
135
120
|
version: '0'
|
136
|
-
segments:
|
137
|
-
- 0
|
138
|
-
hash: -235536360364497139
|
139
121
|
requirements: []
|
140
122
|
rubyforge_project:
|
141
|
-
rubygems_version:
|
123
|
+
rubygems_version: 2.0.3
|
142
124
|
signing_key:
|
143
|
-
specification_version:
|
125
|
+
specification_version: 4
|
144
126
|
summary: Sidekiq support for Apartment
|
145
127
|
test_files:
|
146
128
|
- spec/spec_helper.rb
|