sidekiq-unique-jobs 5.0.2 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq-unique-jobs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/Appraisals +1 -1
- data/CHANGELOG.md +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +21 -0
- data/bin/bench +1 -1
- data/lib/sidekiq-unique-jobs.rb +3 -1
- data/lib/sidekiq/simulator.rb +4 -10
- data/lib/sidekiq_unique_jobs/cli.rb +2 -0
- data/lib/sidekiq_unique_jobs/client/middleware.rb +2 -0
- data/lib/sidekiq_unique_jobs/config.rb +2 -0
- data/lib/sidekiq_unique_jobs/constants.rb +19 -17
- data/lib/sidekiq_unique_jobs/core_ext.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +3 -1
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/until_timeout.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +2 -0
- data/lib/sidekiq_unique_jobs/middleware.rb +2 -0
- data/lib/sidekiq_unique_jobs/normalizer.rb +2 -0
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +2 -0
- data/lib/sidekiq_unique_jobs/run_lock_failed.rb +2 -0
- data/lib/sidekiq_unique_jobs/script_mock.rb +2 -0
- data/lib/sidekiq_unique_jobs/scripts.rb +15 -10
- data/lib/sidekiq_unique_jobs/scripts/acquire_lock.rb +2 -0
- data/lib/sidekiq_unique_jobs/scripts/release_lock.rb +2 -0
- data/lib/sidekiq_unique_jobs/server/middleware.rb +2 -0
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +2 -0
- data/lib/sidekiq_unique_jobs/testing.rb +2 -0
- data/lib/sidekiq_unique_jobs/testing/sidekiq_overrides.rb +2 -0
- data/lib/sidekiq_unique_jobs/timeout_calculator.rb +2 -0
- data/lib/sidekiq_unique_jobs/unique_args.rb +3 -1
- data/lib/sidekiq_unique_jobs/unlockable.rb +2 -0
- data/lib/sidekiq_unique_jobs/util.rb +5 -3
- data/lib/sidekiq_unique_jobs/version.rb +3 -1
- data/sidekiq-unique-jobs.gemspec +27 -23
- metadata +44 -200
- data/LICENSE +0 -13
- data/circle.yml +0 -41
- data/gemfiles/sidekiq_4.0.gemfile +0 -22
- data/gemfiles/sidekiq_4.1.gemfile +0 -22
- data/gemfiles/sidekiq_4.2.gemfile +0 -22
- data/gemfiles/sidekiq_5.0.gemfile +0 -22
- data/gemfiles/sidekiq_develop.gemfile +0 -22
- data/rails_example/.env +0 -12
- data/rails_example/.env.test +0 -12
- data/rails_example/.gitignore +0 -13
- data/rails_example/.rspec +0 -2
- data/rails_example/Gemfile +0 -38
- data/rails_example/Procfile +0 -2
- data/rails_example/README.rdoc +0 -28
- data/rails_example/Rakefile +0 -6
- data/rails_example/app/assets/images/.keep +0 -0
- data/rails_example/app/assets/javascripts/application.js +0 -16
- data/rails_example/app/assets/stylesheets/application.css +0 -15
- data/rails_example/app/channels/appearance_channel.rb +0 -17
- data/rails_example/app/channels/application_cable/channel.rb +0 -4
- data/rails_example/app/channels/application_cable/connection.rb +0 -9
- data/rails_example/app/channels/post_channel.rb +0 -5
- data/rails_example/app/controllers/application_controller.rb +0 -5
- data/rails_example/app/controllers/concerns/.keep +0 -0
- data/rails_example/app/controllers/work_controller.rb +0 -39
- data/rails_example/app/helpers/application_helper.rb +0 -2
- data/rails_example/app/mailers/.keep +0 -0
- data/rails_example/app/models/.keep +0 -0
- data/rails_example/app/models/application_record.rb +0 -3
- data/rails_example/app/models/concerns/.keep +0 -0
- data/rails_example/app/models/guest.rb +0 -18
- data/rails_example/app/models/post.rb +0 -2
- data/rails_example/app/views/layouts/application.html.erb +0 -15
- data/rails_example/app/workers/simple_worker.rb +0 -15
- data/rails_example/app/workers/slow_until_executing_worker.rb +0 -15
- data/rails_example/app/workers/spawn_simple_worker.rb +0 -10
- data/rails_example/app/workers/while_executing_worker.rb +0 -12
- data/rails_example/app/workers/without_args_worker.rb +0 -16
- data/rails_example/app/workers/without_argument_worker.rb +0 -12
- data/rails_example/bin/bundle +0 -3
- data/rails_example/bin/check_or_setup_db +0 -56
- data/rails_example/bin/docker-setup +0 -20
- data/rails_example/bin/rails +0 -4
- data/rails_example/bin/rake +0 -4
- data/rails_example/bin/setup +0 -34
- data/rails_example/bin/update +0 -29
- data/rails_example/cable.ru +0 -6
- data/rails_example/common-services.yml +0 -52
- data/rails_example/config.ru +0 -4
- data/rails_example/config/application.rb +0 -27
- data/rails_example/config/boot.rb +0 -3
- data/rails_example/config/cable.yml +0 -9
- data/rails_example/config/database.docker.yml +0 -12
- data/rails_example/config/database.yml +0 -19
- data/rails_example/config/environment.rb +0 -5
- data/rails_example/config/environments/development.rb +0 -54
- data/rails_example/config/environments/production.rb +0 -86
- data/rails_example/config/environments/test.rb +0 -42
- data/rails_example/config/initializers/application_controller_renderer.rb +0 -6
- data/rails_example/config/initializers/assets.rb +0 -11
- data/rails_example/config/initializers/backtrace_silencers.rb +0 -9
- data/rails_example/config/initializers/cookies_serializer.rb +0 -5
- data/rails_example/config/initializers/filter_parameter_logging.rb +0 -4
- data/rails_example/config/initializers/inflections.rb +0 -16
- data/rails_example/config/initializers/mime_types.rb +0 -4
- data/rails_example/config/initializers/new_framework_defaults.rb +0 -23
- data/rails_example/config/initializers/session_store.rb +0 -3
- data/rails_example/config/initializers/sidekiq.rb +0 -13
- data/rails_example/config/initializers/wrap_parameters.rb +0 -14
- data/rails_example/config/locales/en.yml +0 -23
- data/rails_example/config/puma.rb +0 -38
- data/rails_example/config/routes.rb +0 -8
- data/rails_example/config/secrets.yml +0 -22
- data/rails_example/config/sidekiq.yml +0 -6
- data/rails_example/config/spring.rb +0 -6
- data/rails_example/db/migrate/20160724111322_create_posts.rb +0 -12
- data/rails_example/db/schema.rb +0 -25
- data/rails_example/db/seeds.rb +0 -7
- data/rails_example/dev-entrypoint.sh +0 -55
- data/rails_example/dev.env +0 -12
- data/rails_example/docker-compose.yml +0 -71
- data/rails_example/docker/rails.Dockerfile +0 -27
- data/rails_example/lib/assets/.keep +0 -0
- data/rails_example/lib/tasks/.keep +0 -0
- data/rails_example/log/.keep +0 -0
- data/rails_example/public/404.html +0 -67
- data/rails_example/public/422.html +0 -67
- data/rails_example/public/500.html +0 -66
- data/rails_example/public/favicon.ico +0 -0
- data/rails_example/public/robots.txt +0 -5
- data/rails_example/simple.ru +0 -12
- data/rails_example/spec/controllers/work_controller_mock_spec.rb +0 -91
- data/rails_example/spec/controllers/work_controller_spec.rb +0 -77
- data/rails_example/spec/factories/posts.rb +0 -8
- data/rails_example/spec/models/post_spec.rb +0 -4
- data/rails_example/spec/rails_helper.rb +0 -20
- data/rails_example/spec/spec_helper.rb +0 -20
- data/rails_example/spec/support/sidekiq_meta.rb +0 -12
- data/rails_example/spec/workers/simple_worker_spec.rb +0 -4
- data/rails_example/vendor/assets/javascripts/.keep +0 -0
- data/rails_example/vendor/assets/stylesheets/.keep +0 -0
- data/spec/jobs/another_unique_job.rb +0 -13
- data/spec/jobs/custom_queue_job.rb +0 -5
- data/spec/jobs/custom_queue_job_with_filter_method.rb +0 -7
- data/spec/jobs/custom_queue_job_with_filter_proc.rb +0 -10
- data/spec/jobs/expiring_job.rb +0 -4
- data/spec/jobs/inline_worker.rb +0 -8
- data/spec/jobs/just_a_worker.rb +0 -7
- data/spec/jobs/long_running_job.rb +0 -6
- data/spec/jobs/main_job.rb +0 -7
- data/spec/jobs/my_job.rb +0 -12
- data/spec/jobs/my_unique_job.rb +0 -11
- data/spec/jobs/my_unique_job_with_filter_method.rb +0 -17
- data/spec/jobs/my_unique_job_with_filter_proc.rb +0 -15
- data/spec/jobs/notify_worker.rb +0 -10
- data/spec/jobs/plain_class.rb +0 -3
- data/spec/jobs/simple_worker.rb +0 -11
- data/spec/jobs/spawn_simple_worker.rb +0 -8
- data/spec/jobs/test_class.rb +0 -3
- data/spec/jobs/unique_job_with_conditional_parameter.rb +0 -14
- data/spec/jobs/unique_job_with_filter_method.rb +0 -18
- data/spec/jobs/unique_job_with_nil_unique_args.rb +0 -16
- data/spec/jobs/unique_job_with_no_unique_args_method.rb +0 -12
- data/spec/jobs/unique_job_withthout_unique_args_parameter.rb +0 -14
- data/spec/jobs/unique_on_all_queues_job.rb +0 -13
- data/spec/jobs/until_and_while_executing_job.rb +0 -7
- data/spec/jobs/until_executed_job.rb +0 -17
- data/spec/jobs/until_executing_job.rb +0 -7
- data/spec/jobs/until_global_timeout_job.rb +0 -8
- data/spec/jobs/until_timeout_job.rb +0 -8
- data/spec/jobs/while_executing_job.rb +0 -12
- data/spec/jobs/without_argument_job.rb +0 -9
- data/spec/lib/sidekiq_unique_jobs/cli_spec.rb +0 -183
- data/spec/lib/sidekiq_unique_jobs/client/middleware_spec.rb +0 -316
- data/spec/lib/sidekiq_unique_jobs/config_spec.rb +0 -84
- data/spec/lib/sidekiq_unique_jobs/core_ext_spec.rb +0 -25
- data/spec/lib/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb +0 -42
- data/spec/lib/sidekiq_unique_jobs/lock/until_executed_spec.rb +0 -37
- data/spec/lib/sidekiq_unique_jobs/lock/until_timeout_spec.rb +0 -26
- data/spec/lib/sidekiq_unique_jobs/lock/while_executing_spec.rb +0 -86
- data/spec/lib/sidekiq_unique_jobs/normalizer_spec.rb +0 -21
- data/spec/lib/sidekiq_unique_jobs/options_with_fallback_spec.rb +0 -113
- data/spec/lib/sidekiq_unique_jobs/queue_lock_timeout_calculator_spec.rb +0 -47
- data/spec/lib/sidekiq_unique_jobs/run_lock_timeout_calculator_spec.rb +0 -36
- data/spec/lib/sidekiq_unique_jobs/script_mock_spec.rb +0 -88
- data/spec/lib/sidekiq_unique_jobs/scripts/acquire_lock_spec.rb +0 -50
- data/spec/lib/sidekiq_unique_jobs/scripts/release_lock_spec.rb +0 -41
- data/spec/lib/sidekiq_unique_jobs/scripts_spec.rb +0 -68
- data/spec/lib/sidekiq_unique_jobs/server/middleware_spec.rb +0 -78
- data/spec/lib/sidekiq_unique_jobs/sidekiq_testing_enabled_spec.rb +0 -164
- data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_ext_spec.rb +0 -75
- data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_jobs_spec.rb +0 -41
- data/spec/lib/sidekiq_unique_jobs/timeout_calculator_spec.rb +0 -70
- data/spec/lib/sidekiq_unique_jobs/unique_args_spec.rb +0 -257
- data/spec/lib/sidekiq_unique_jobs/unlockable_spec.rb +0 -37
- data/spec/lib/sidekiq_unique_jobs/util_spec.rb +0 -81
- data/spec/spec_helper.rb +0 -92
- data/spec/support/matchers/redis_matchers.rb +0 -29
- data/spec/support/ruby_meta.rb +0 -17
- data/spec/support/sidekiq_meta.rb +0 -30
- data/spec/support/unique_macros.rb +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11b1c4aca9391461a5744ff361b1bd1d549a5d1e
|
4
|
+
data.tar.gz: d336770bd8f907edab6805a2f394b4d2bc26ef08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ac16889831fe0a6c072091cc4becc17e1e988867c8474788bf8f3d369ff2f6b83519b563080761727ffc13e9dd1b1559daf761779019fbcb1a8225c129299e
|
7
|
+
data.tar.gz: ecc7c5c08bfa9f2aab973e30d6ad3c044de0a8da5bd5a6b39c87273509b758795882c8a1ee0707d5c8fb31c776f725210dbe8029c9c96d8c13ca08478df5b643
|
data/.rubocop.yml
CHANGED
@@ -42,7 +42,7 @@ Style/ConstantName:
|
|
42
42
|
Enabled: true
|
43
43
|
|
44
44
|
Style/FrozenStringLiteralComment:
|
45
|
-
Enabled:
|
45
|
+
Enabled: true
|
46
46
|
|
47
47
|
Style/Documentation:
|
48
48
|
Enabled: false
|
@@ -51,6 +51,9 @@ Style/FileName:
|
|
51
51
|
Enabled: true
|
52
52
|
Exclude:
|
53
53
|
- 'lib/sidekiq-unique-jobs.rb'
|
54
|
+
- '**/Gemfile'
|
55
|
+
- '**/Appraisals'
|
56
|
+
- '**/*.gemspec'
|
54
57
|
|
55
58
|
Style/GlobalVars:
|
56
59
|
Enabled: true
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## v5.0.4
|
2
|
+
- Fixes a problem with installing the gem
|
3
|
+
|
4
|
+
## v5.0.3
|
5
|
+
- Removes test files and appraisals and such from the released gem version to speed up gem installs
|
6
|
+
|
7
|
+
## v5.0.2
|
8
|
+
- Added more helpful debug, warning and error messages for failures to collect unique arghuments
|
9
|
+
|
1
10
|
## v5.0.1
|
2
11
|
|
3
12
|
- Added a command line util for cleaning out expired keys
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mikael@zoolutions.se. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Mikael Henriksson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/bin/bench
CHANGED
@@ -14,7 +14,7 @@ ITERATIONS ||= 10_000
|
|
14
14
|
Benchmark.ips do |x|
|
15
15
|
x.config(time: 5, warmup: 2)
|
16
16
|
x.report('new_shit') do |_times|
|
17
|
-
SidekiqUniqueJobs::Scripts.
|
17
|
+
SidekiqUniqueJobs::Scripts::AcquireLock.execute(nil, SecureRandom.hex, SecureRandom.hex)
|
18
18
|
end
|
19
19
|
x.compare!
|
20
20
|
end
|
data/lib/sidekiq-unique-jobs.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml' if RUBY_VERSION.include?('2.0.0')
|
2
4
|
require 'forwardable'
|
3
5
|
require 'sidekiq_unique_jobs/version'
|
@@ -66,7 +68,7 @@ module SidekiqUniqueJobs
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def redis_version
|
69
|
-
@redis_version ||= connection { |c| c.info('server'
|
71
|
+
@redis_version ||= connection { |c| c.info('server')['redis_version'] }
|
70
72
|
end
|
71
73
|
|
72
74
|
def connection(redis_pool = nil)
|
data/lib/sidekiq/simulator.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'sidekiq/launcher'
|
2
4
|
require 'timeout'
|
3
5
|
|
@@ -38,19 +40,11 @@ module Sidekiq
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def terminate_launcher
|
41
|
-
|
42
|
-
launcher.terminate # Better to be fast than graceful for our purposes
|
43
|
-
else
|
44
|
-
launcher.stop # New sidekiq works better
|
45
|
-
end
|
43
|
+
launcher.stop
|
46
44
|
end
|
47
45
|
|
48
46
|
def alive?
|
49
|
-
|
50
|
-
launcher.alive?
|
51
|
-
else
|
52
|
-
launcher.manager.workers.any?
|
53
|
-
end
|
47
|
+
launcher.manager.workers.any?
|
54
48
|
end
|
55
49
|
|
56
50
|
def stopped?
|
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SidekiqUniqueJobs
|
2
|
-
ARGS_KEY ||= 'args'
|
3
|
-
AT_KEY ||= 'at'
|
4
|
-
CLASS_KEY ||= 'class'
|
5
|
-
JID_KEY ||= 'jid'
|
6
|
-
LOG_DUPLICATE_KEY ||= 'log_duplicate_payload'
|
7
|
-
QUEUE_KEY ||= 'queue'
|
8
|
-
HASH_KEY ||= 'uniquejobs'
|
9
|
-
QUEUE_LOCK_TIMEOUT_KEY ||= 'unique_expiration'
|
10
|
-
RUN_LOCK_TIMEOUT_KEY ||= 'run_lock_expiration'
|
11
|
-
TESTING_CONSTANT ||= 'Testing'
|
12
|
-
UNIQUE_KEY ||= 'unique'
|
13
|
-
UNIQUE_LOCK_KEY ||= 'unique_lock'
|
14
|
-
UNIQUE_ARGS_KEY ||= 'unique_args'
|
15
|
-
UNIQUE_PREFIX_KEY ||= 'unique_prefix'
|
16
|
-
UNIQUE_DIGEST_KEY ||= 'unique_digest'
|
17
|
-
UNIQUE_ON_ALL_QUEUES_KEY ||= 'unique_on_all_queues'
|
18
|
-
UNIQUE_ARGS_ENABLED_KEY ||= 'unique_args_enabled'
|
4
|
+
ARGS_KEY ||= 'args'
|
5
|
+
AT_KEY ||= 'at'
|
6
|
+
CLASS_KEY ||= 'class'
|
7
|
+
JID_KEY ||= 'jid'
|
8
|
+
LOG_DUPLICATE_KEY ||= 'log_duplicate_payload'
|
9
|
+
QUEUE_KEY ||= 'queue'
|
10
|
+
HASH_KEY ||= 'uniquejobs'
|
11
|
+
QUEUE_LOCK_TIMEOUT_KEY ||= 'unique_expiration'
|
12
|
+
RUN_LOCK_TIMEOUT_KEY ||= 'run_lock_expiration'
|
13
|
+
TESTING_CONSTANT ||= 'Testing'
|
14
|
+
UNIQUE_KEY ||= 'unique'
|
15
|
+
UNIQUE_LOCK_KEY ||= 'unique_lock'
|
16
|
+
UNIQUE_ARGS_KEY ||= 'unique_args'
|
17
|
+
UNIQUE_PREFIX_KEY ||= 'unique_prefix'
|
18
|
+
UNIQUE_DIGEST_KEY ||= 'unique_digest'
|
19
|
+
UNIQUE_ON_ALL_QUEUES_KEY ||= 'unique_on_all_queues'
|
20
|
+
UNIQUE_ARGS_ENABLED_KEY ||= 'unique_args_enabled'
|
19
21
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
require 'digest/sha1'
|
3
5
|
require 'concurrent/map'
|
@@ -22,22 +24,25 @@ module SidekiqUniqueJobs
|
|
22
24
|
extend SingleForwardable
|
23
25
|
def_delegators :SidekiqUniqueJobs, :connection, :logger
|
24
26
|
|
25
|
-
def call(file_name, redis_pool, options = {})
|
27
|
+
def call(file_name, redis_pool, options = {})
|
28
|
+
internal_call(file_name, redis_pool, options)
|
29
|
+
rescue Redis::CommandError => ex
|
30
|
+
handle_error(ex, file_name, redis_pool, options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def internal_call(file_name, redis_pool, options = {})
|
26
34
|
connection(redis_pool) do |redis|
|
27
|
-
if SCRIPT_SHAS[file_name].nil?
|
28
|
-
SCRIPT_SHAS[file_name] = redis.script(:load, script_source(file_name))
|
29
|
-
end
|
35
|
+
SCRIPT_SHAS[file_name] = redis.script(:load, script_source(file_name)) if SCRIPT_SHAS[file_name].nil?
|
30
36
|
redis.evalsha(SCRIPT_SHAS[file_name], options)
|
31
37
|
end
|
32
|
-
|
33
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
def handle_error(ex, file_name, redis_pool, options = {})
|
41
|
+
if ex.message == 'NOSCRIPT No matching script. Please use EVAL.' # rubocop:disable Style/GuardClause
|
34
42
|
SCRIPT_SHAS.delete(file_name)
|
35
43
|
call(file_name, redis_pool, options)
|
36
|
-
raise
|
37
44
|
else
|
38
|
-
raise ScriptError,
|
39
|
-
"#{file_name}.lua\n\n#{ex.message}\n\n#{script_source(file_name)}" \
|
40
|
-
"#{ex.backtrace.join("\n")}"
|
45
|
+
raise ScriptError, "Problem compiling #{file_name}. Invalid LUA syntax?"
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|