multi-background-job 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/specs.yml +35 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.tool-versions +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +137 -0
- data/Rakefile +2 -0
- data/bin/console +13 -0
- data/bin/setup +6 -0
- data/lib/multi-background-job.rb +3 -0
- data/lib/multi_background_job.rb +89 -0
- data/lib/multi_background_job/adapters/adapter.rb +23 -0
- data/lib/multi_background_job/adapters/faktory.rb +111 -0
- data/lib/multi_background_job/adapters/sidekiq.rb +91 -0
- data/lib/multi_background_job/config.rb +152 -0
- data/lib/multi_background_job/errors.rb +25 -0
- data/lib/multi_background_job/lock.rb +137 -0
- data/lib/multi_background_job/lock_digest.rb +39 -0
- data/lib/multi_background_job/middleware/unique_job.rb +69 -0
- data/lib/multi_background_job/middleware/unique_job/faktory.rb +41 -0
- data/lib/multi_background_job/middleware/unique_job/sidekiq.rb +48 -0
- data/lib/multi_background_job/middleware_chain.rb +109 -0
- data/lib/multi_background_job/unique_job.rb +84 -0
- data/lib/multi_background_job/version.rb +5 -0
- data/lib/multi_background_job/worker.rb +114 -0
- data/lib/multi_background_job/workers/faktory.rb +28 -0
- data/lib/multi_background_job/workers/shared_class_methods.rb +26 -0
- data/lib/multi_background_job/workers/sidekiq.rb +28 -0
- data/multi-background-job.gemspec +39 -0
- metadata +122 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# frizen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './shared_class_methods'
|
4
|
+
|
5
|
+
module MultiBackgroundJob
|
6
|
+
module Workers
|
7
|
+
module Sidekiq
|
8
|
+
def self.extended(base)
|
9
|
+
base.include(::Sidekiq::Worker) if defined?(::Sidekiq)
|
10
|
+
base.extend SharedClassMethods
|
11
|
+
base.extend ClassMethods
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def service_worker_options
|
16
|
+
default_queue = MultiBackgroundJob.config.workers.dig(self.name, :queue)
|
17
|
+
default_retry = MultiBackgroundJob.config.workers.dig(self.name, :retry)
|
18
|
+
default_queue ||= ::Sidekiq.default_worker_options['queue'] if defined?(::Sidekiq)
|
19
|
+
default_retry ||= ::Sidekiq.default_worker_options['retry'] if defined?(::Sidekiq)
|
20
|
+
{
|
21
|
+
queue: (default_queue || 'default'),
|
22
|
+
retry: (default_retry || 15),
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative 'lib/multi_background_job/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'multi-background-job'
|
5
|
+
spec.version = MultiBackgroundJob::VERSION
|
6
|
+
spec.authors = ['Marcos G. Zimmermann']
|
7
|
+
spec.email = ['mgzmaster@gmail.com']
|
8
|
+
|
9
|
+
spec.summary = <<~SUMMARY
|
10
|
+
A generic swappable background-job handling.
|
11
|
+
SUMMARY
|
12
|
+
spec.description = <<~DESCRIPTION
|
13
|
+
A generic swappable background-job handling.
|
14
|
+
DESCRIPTION
|
15
|
+
|
16
|
+
spec.homepage = 'https://github.com/marcosgz/multi-background-job'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
19
|
+
|
20
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
21
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
22
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/marcosgz/multi-background-job/issues'
|
23
|
+
spec.metadata['documentation_uri'] = 'https://github.com/marcosgz/multi-background-job'
|
24
|
+
spec.metadata['source_code_uri'] = 'https://github.com/marcosgz/multi-background-job'
|
25
|
+
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
|
32
|
+
spec.bindir = 'exe'
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ['lib']
|
35
|
+
|
36
|
+
spec.add_dependency 'redis', '>= 0.0.0'
|
37
|
+
spec.add_dependency 'connection_pool', '>= 0.0.0'
|
38
|
+
spec.add_dependency 'multi_json', '>= 0.0.0'
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: multi-background-job
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcos G. Zimmermann
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redis
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: connection_pool
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: multi_json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.0
|
55
|
+
description: 'A generic swappable background-job handling.
|
56
|
+
|
57
|
+
'
|
58
|
+
email:
|
59
|
+
- mgzmaster@gmail.com
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".github/workflows/specs.yml"
|
65
|
+
- ".gitignore"
|
66
|
+
- ".rspec"
|
67
|
+
- ".tool-versions"
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- bin/console
|
74
|
+
- bin/setup
|
75
|
+
- lib/multi-background-job.rb
|
76
|
+
- lib/multi_background_job.rb
|
77
|
+
- lib/multi_background_job/adapters/adapter.rb
|
78
|
+
- lib/multi_background_job/adapters/faktory.rb
|
79
|
+
- lib/multi_background_job/adapters/sidekiq.rb
|
80
|
+
- lib/multi_background_job/config.rb
|
81
|
+
- lib/multi_background_job/errors.rb
|
82
|
+
- lib/multi_background_job/lock.rb
|
83
|
+
- lib/multi_background_job/lock_digest.rb
|
84
|
+
- lib/multi_background_job/middleware/unique_job.rb
|
85
|
+
- lib/multi_background_job/middleware/unique_job/faktory.rb
|
86
|
+
- lib/multi_background_job/middleware/unique_job/sidekiq.rb
|
87
|
+
- lib/multi_background_job/middleware_chain.rb
|
88
|
+
- lib/multi_background_job/unique_job.rb
|
89
|
+
- lib/multi_background_job/version.rb
|
90
|
+
- lib/multi_background_job/worker.rb
|
91
|
+
- lib/multi_background_job/workers/faktory.rb
|
92
|
+
- lib/multi_background_job/workers/shared_class_methods.rb
|
93
|
+
- lib/multi_background_job/workers/sidekiq.rb
|
94
|
+
- multi-background-job.gemspec
|
95
|
+
homepage: https://github.com/marcosgz/multi-background-job
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata:
|
99
|
+
homepage_uri: https://github.com/marcosgz/multi-background-job
|
100
|
+
bug_tracker_uri: https://github.com/marcosgz/multi-background-job/issues
|
101
|
+
documentation_uri: https://github.com/marcosgz/multi-background-job
|
102
|
+
source_code_uri: https://github.com/marcosgz/multi-background-job
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 2.3.0
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubygems_version: 3.0.3
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: A generic swappable background-job handling.
|
122
|
+
test_files: []
|