ros-apartment-sidekiq 1.2.0
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/.gitignore +17 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/apartment-sidekiq.gemspec +27 -0
- data/lib/apartment-sidekiq.rb +1 -0
- data/lib/apartment/sidekiq.rb +36 -0
- data/lib/apartment/sidekiq/middleware/client.rb +8 -0
- data/lib/apartment/sidekiq/middleware/honeybadger/server.rb +9 -0
- data/lib/apartment/sidekiq/middleware/server.rb +9 -0
- data/lib/apartment/sidekiq/railtie.rb +7 -0
- data/lib/apartment/sidekiq/version.rb +5 -0
- data/spec/spec_helper.rb +3 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bf5f3580d0380ca484c860dff7fa391ccc9f27f84379e1902222f35e44de19bd
|
4
|
+
data.tar.gz: 58aaccff89bd0dbf9da9c7c60aad610be3b72a8737b7bdabc022a0f748235dfa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9edad661f476e3d05cf7afdec60da319953e107ec7ff55b8adb9d792f901b34d2f64af4646507f7a9ba202bc5eb0e63fb692e51f871304331d2afbe4d84b7b44
|
7
|
+
data.tar.gz: 24fe9766cff9795b24537023e107b3a2e08b139a1d239be603082c00002897b812ae8a85371578d186a7b109ab51696f123a72be276330773d53cd90fe541306
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# master (unreleased)
|
2
|
+
|
3
|
+
# 1.2.0 (2017-12-17)
|
4
|
+
|
5
|
+
* [#16](https://github.com/influitive/apartment-sidekiq/pull/16): Sidekiq::Batch compatibility [@mperham]
|
6
|
+
* [#20](https://github.com/influitive/apartment-sidekiq/issues/20): Relax apartment version in gemspec [@MSeneadza]
|
7
|
+
* @jhubert, @JanStevens and @1990prashant also opened issues/pull requests about this problem
|
8
|
+
* [#24](https://github.com/influitive/apartment-sidekiq/pull/24): Fix Sidekiq Pro Batch Lookup [@JanStevens]
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Brad Robertson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Apartment::Sidekiq
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/apartment-sidekiq)
|
4
|
+
|
5
|
+
Official Support for Sidekiq with the Apartment Gem.
|
6
|
+
|
7
|
+
This gem takes care of storing the current tenant that a job is enqueued within.
|
8
|
+
It will then switch to that tenant for the duration of the job processing.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'ros-apartment-sidekiq'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install ros-apartment-sidekiq
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
That's it. There's nothing to do. Each job that is queued will get an additional entry
|
27
|
+
storing `Apartment::Tenant.current` when it is queued. Then when the server pops it,
|
28
|
+
it will run job within an `Apartment::Tenant.switch` block.
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'apartment/sidekiq/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ros-apartment-sidekiq"
|
8
|
+
spec.version = Apartment::Sidekiq::VERSION
|
9
|
+
spec.authors = ["Brad Robertson", "Rui Baltazar"]
|
10
|
+
spec.email = ["brad@influitive.com", "rui.p.baltazar@gmail.com"]
|
11
|
+
spec.description = %q{Enable Multi-tenant supported jobs to work with Sidekiq background worker}
|
12
|
+
spec.summary = %q{Sidekiq support for Ros Apartment}
|
13
|
+
spec.homepage = "https://github.com/rails-on-services/apartment-sidekiq"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency 'minitest'
|
24
|
+
|
25
|
+
spec.add_dependency 'ros-apartment', '>= 1.0'
|
26
|
+
spec.add_dependency 'sidekiq', '>= 2.11'
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'apartment/sidekiq'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'apartment/sidekiq/version'
|
2
|
+
require 'sidekiq'
|
3
|
+
|
4
|
+
require 'apartment/sidekiq/middleware/client'
|
5
|
+
require 'apartment/sidekiq/middleware/server'
|
6
|
+
|
7
|
+
module Apartment
|
8
|
+
module Sidekiq
|
9
|
+
module Middleware
|
10
|
+
|
11
|
+
def self.run
|
12
|
+
::Sidekiq.configure_client do |config|
|
13
|
+
config.client_middleware do |chain|
|
14
|
+
chain.add ::Apartment::Sidekiq::Middleware::Client
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
::Sidekiq.configure_server do |config|
|
19
|
+
config.client_middleware do |chain|
|
20
|
+
chain.add ::Apartment::Sidekiq::Middleware::Client
|
21
|
+
end
|
22
|
+
|
23
|
+
config.server_middleware do |chain|
|
24
|
+
if defined?(::Sidekiq::Batch::Server)
|
25
|
+
chain.insert_before ::Sidekiq::Batch::Server, ::Apartment::Sidekiq::Middleware::Server
|
26
|
+
else
|
27
|
+
chain.add ::Apartment::Sidekiq::Middleware::Server
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'apartment/sidekiq/railtie' if defined?(Rails)
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ros-apartment-sidekiq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brad Robertson
|
8
|
+
- Rui Baltazar
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-01-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.6'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: minitest
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: ros-apartment
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: sidekiq
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.11'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.11'
|
84
|
+
description: Enable Multi-tenant supported jobs to work with Sidekiq background worker
|
85
|
+
email:
|
86
|
+
- brad@influitive.com
|
87
|
+
- rui.p.baltazar@gmail.com
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- CHANGELOG.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- apartment-sidekiq.gemspec
|
99
|
+
- lib/apartment-sidekiq.rb
|
100
|
+
- lib/apartment/sidekiq.rb
|
101
|
+
- lib/apartment/sidekiq/middleware/client.rb
|
102
|
+
- lib/apartment/sidekiq/middleware/honeybadger/server.rb
|
103
|
+
- lib/apartment/sidekiq/middleware/server.rb
|
104
|
+
- lib/apartment/sidekiq/railtie.rb
|
105
|
+
- lib/apartment/sidekiq/version.rb
|
106
|
+
- spec/spec_helper.rb
|
107
|
+
homepage: https://github.com/rails-on-services/apartment-sidekiq
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubygems_version: 3.0.6
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Sidekiq support for Ros Apartment
|
130
|
+
test_files:
|
131
|
+
- spec/spec_helper.rb
|