sidekiq-undertaker 1.6.0 → 1.8.0.rc01
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 +4 -4
- data/.github/workflows/ruby-build.yml +8 -6
- data/.rubocop.yml +6 -5
- data/.rubocop_codeclimate.yml +1 -1
- data/.rubocop_todo.yml +20 -8
- data/CHANGELOG.md +21 -0
- data/Gemfile +19 -2
- data/lib/sidekiq/undertaker/dead_job.rb +1 -1
- data/lib/sidekiq/undertaker/version.rb +1 -1
- data/lib/sidekiq/undertaker/web_extension/api_helpers.rb +44 -33
- data/lib/sidekiq/undertaker.rb +5 -3
- data/renovate.json +3 -2
- data/sidekiq-undertaker.gemspec +3 -24
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_filter_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +377 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +362 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +362 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +352 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +352 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_all_failures_and_errors/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +212 -98
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +407 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/with_pagination/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +276 -160
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +407 -0
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/with_pagination/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +276 -160
- data/spec/sidekiq/undertaker/dead_jobs_spec.rb +2 -2
- data/spec/sidekiq/undertaker/web_extension_spec.rb +12 -13
- data/spec/spec_helper.rb +14 -1
- data/spec/support/monkey_patch/approvals/writers/text_writer.rb +20 -0
- metadata +17 -305
- data/.github/dependabot.yml +0 -8
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_filter_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -256
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_filter_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -265
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -241
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -250
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -241
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -250
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -231
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -240
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -231
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -240
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_all_failures_and_errors/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -326
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -284
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -293
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/with_pagination/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -1310
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -284
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -293
- data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/with_pagination/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv6.approved.txt +0 -1310
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ccb3fbe284cdf7f6b60c6a54a3d6908a46353c8c38e6c05d3a53eb1e006c87
|
4
|
+
data.tar.gz: 13302f23e5c7120e74db0a82768bf5bfcc0b80b4ebd922c882338bcf7c5d8bdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5433a9ee7ac4ce59929f96d7df81f37e812a793a84b2aec52eaf371b1a8d3dc24f3295be7f13e385aec3ad57797968061a2e5faa60b8a37a6d79b8616ed9b39d
|
7
|
+
data.tar.gz: 4b4d850c9dd183e9edf73094facc0aafcddb8ebef9f5ac8ba7c1d09c7ffdd52b324260e9eb9b9b92a728847a14874d25a96d097009ee6b68b37089b337f2e98c
|
@@ -30,9 +30,11 @@ jobs:
|
|
30
30
|
matrix:
|
31
31
|
# SEE: https://github.com/ruby/setup-ruby#supported-versions
|
32
32
|
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
|
33
|
-
ruby-version: ['ruby', '3.
|
33
|
+
ruby-version: ['ruby', '3.3', '3.2']
|
34
34
|
experimental: [false]
|
35
35
|
include: # HINT: Do not use arrays for values here
|
36
|
+
- ruby-version: 'jruby'
|
37
|
+
experimental: true
|
36
38
|
- ruby-version: 'truffleruby'
|
37
39
|
experimental: true
|
38
40
|
- ruby-version: 'truffleruby+graalvm'
|
@@ -42,7 +44,7 @@ jobs:
|
|
42
44
|
JRUBY_OPTS: '--debug'
|
43
45
|
|
44
46
|
steps:
|
45
|
-
- uses: actions/checkout@
|
47
|
+
- uses: actions/checkout@v4
|
46
48
|
- name: Set up Ruby
|
47
49
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
48
50
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
@@ -53,7 +55,7 @@ jobs:
|
|
53
55
|
- name: Run tests
|
54
56
|
run: COVERAGE=true bundle exec rspec
|
55
57
|
- name: 'Upload Coverage Report'
|
56
|
-
uses: actions/upload-artifact@
|
58
|
+
uses: actions/upload-artifact@v4
|
57
59
|
if: ${{ matrix.ruby-version == 'ruby' }}
|
58
60
|
with:
|
59
61
|
name: coverage-report
|
@@ -65,13 +67,13 @@ jobs:
|
|
65
67
|
name: coverage
|
66
68
|
runs-on: ubuntu-latest
|
67
69
|
steps:
|
68
|
-
- uses: actions/checkout@
|
70
|
+
- uses: actions/checkout@v4
|
69
71
|
- name: Download Coverage Report
|
70
|
-
uses: actions/download-artifact@
|
72
|
+
uses: actions/download-artifact@v4
|
71
73
|
with:
|
72
74
|
name: coverage-report
|
73
75
|
path: ./coverage
|
74
|
-
- uses: paambaati/codeclimate-action@
|
76
|
+
- uses: paambaati/codeclimate-action@v9.0.0
|
75
77
|
env:
|
76
78
|
# Set CC_TEST_REPORTER_ID as secret of your repo
|
77
79
|
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
plugins:
|
2
4
|
- rubocop-rake
|
3
5
|
- rubocop-rspec
|
4
|
-
- rt_rubocop_defaults
|
5
6
|
|
6
|
-
|
7
|
+
require:
|
8
|
+
- rt_rubocop_defaults
|
7
9
|
|
8
10
|
AllCops:
|
9
|
-
TargetRubyVersion: 2
|
10
|
-
|
11
|
+
TargetRubyVersion: 3.2
|
11
12
|
Layout/LineLength:
|
12
13
|
Exclude:
|
13
14
|
- 'sidekiq-undertaker.gemspec'
|
data/.rubocop_codeclimate.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,23 +1,35 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2025-03-13 16:14:24 UTC using RuboCop version 1.74.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters:
|
9
|
+
# Offense count: 3
|
10
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Severity.
|
11
11
|
Metrics/AbcSize:
|
12
|
-
Max:
|
12
|
+
Max: 19
|
13
13
|
|
14
|
-
# Offense count:
|
15
|
-
# Configuration parameters:
|
16
|
-
|
17
|
-
|
14
|
+
# Offense count: 21
|
15
|
+
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
16
|
+
RSpec/IndexedLet:
|
17
|
+
Exclude:
|
18
|
+
- 'spec/sidekiq/undertaker/job_distributor_spec.rb'
|
19
|
+
- 'spec/sidekiq/undertaker/job_filter_spec.rb'
|
20
|
+
- 'spec/sidekiq/undertaker/web_extension_spec.rb'
|
18
21
|
|
19
22
|
# Offense count: 5
|
20
23
|
# Configuration parameters: .
|
21
24
|
# SupportedStyles: have_received, receive
|
22
25
|
RSpec/MessageSpies:
|
23
26
|
EnforcedStyle: receive
|
27
|
+
|
28
|
+
# Offense count: 1
|
29
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
30
|
+
# Configuration parameters: EnforcedStyle.
|
31
|
+
# SupportedStyles: always, always_true, never
|
32
|
+
Style/FrozenStringLiteralComment:
|
33
|
+
Exclude:
|
34
|
+
- '**/*.arb'
|
35
|
+
- 'spec/support/monkey_patch/approvals/writers/text_writer.rb'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## [1.8.0]
|
6
|
+
|
7
|
+
## Changed
|
8
|
+
- Remove Dependabot
|
9
|
+
- Add Renovate dependency dashboard
|
10
|
+
- Update test dependency sinatra to v4
|
11
|
+
- Update paambaati/codeclimate-action action to v9
|
12
|
+
- Update build config
|
13
|
+
- Upgrade Sidekiq to version 8
|
14
|
+
- Drop Ruby 3.1 suppport
|
15
|
+
|
16
|
+
## [1.7.0] - 2023-12-15
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
- Dropped Ruby 2.x support
|
20
|
+
- Dropped Sidekiq 6.x support
|
21
|
+
- Updated rspec-sidekiq to 4.1
|
22
|
+
- Updated sinatra to 3.1
|
23
|
+
- Updated actions/checkout, actions/upload-artifact and actions/download-artifact to v4
|
24
|
+
- Updated paambaati/codeclimate-action to v5
|
25
|
+
|
5
26
|
## [1.6.0] - 2022-11-02
|
6
27
|
|
7
28
|
### Changed
|
data/Gemfile
CHANGED
@@ -2,10 +2,27 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
gem "approvals", "~> 0.1.0"
|
6
|
+
gem "mock_redis", "~> 0.19"
|
7
|
+
gem "pry", "~> 0.12"
|
8
|
+
gem "rack-test", "~> 2.0"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rb-readline", "~> 0.5"
|
11
|
+
gem "rspec", "~> 3.12"
|
12
|
+
gem "rspec-sidekiq", "~> 5.0"
|
13
|
+
gem "rt_rubocop_defaults", "~> 2.6"
|
14
|
+
gem "rubocop", "~> 1.59"
|
15
|
+
gem "rubocop-rake", "~> 0.6"
|
16
|
+
gem "rubocop-rspec", "~> 3.0"
|
17
|
+
gem "rubocop_runner", "~> 2.2"
|
18
|
+
gem "simplecov", "~> 0.21"
|
19
|
+
gem "sinatra", "~> 4.0"
|
20
|
+
gem "timecop", "~> 0.9"
|
7
21
|
|
8
22
|
# Good for debuging on travis-ci.org
|
9
23
|
# group :development, :test do
|
10
24
|
# gem "approvals", git: "https://github.com/br/approvals", branch: "diff-preview"
|
11
25
|
# end
|
26
|
+
|
27
|
+
# Specify your gem's dependencies in sidekiq-undertaker.gemspec
|
28
|
+
gemspec
|
@@ -17,7 +17,7 @@ module Sidekiq
|
|
17
17
|
job_time_elapsed_since_failure = Time.now.to_i - job_failed_at.to_i
|
18
18
|
job_bucket_name = Bucket.for_elapsed_time(job_time_elapsed_since_failure)
|
19
19
|
|
20
|
-
new(job
|
20
|
+
new(job:,
|
21
21
|
time_elapsed_since_failure: job_time_elapsed_since_failure,
|
22
22
|
bucket_name: job_bucket_name)
|
23
23
|
end
|
@@ -16,7 +16,7 @@ module Sidekiq
|
|
16
16
|
def show_filter
|
17
17
|
store_request_params
|
18
18
|
|
19
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(
|
19
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
20
20
|
@distribution = Sidekiq::Undertaker::JobDistributor.new(@dead_jobs).group_by_job_class
|
21
21
|
@total_dead = @dead_jobs.size
|
22
22
|
|
@@ -26,7 +26,7 @@ module Sidekiq
|
|
26
26
|
def show_filter_by_job_class_bucket_name
|
27
27
|
store_request_params
|
28
28
|
|
29
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(
|
29
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
30
30
|
@distribution = Sidekiq::Undertaker::JobDistributor.new(@dead_jobs).group_by_error_class
|
31
31
|
@total_dead = @dead_jobs.size
|
32
32
|
|
@@ -36,7 +36,7 @@ module Sidekiq
|
|
36
36
|
def show_filter_by_job_class_error_class_bucket_name
|
37
37
|
store_request_params
|
38
38
|
|
39
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(
|
39
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
40
40
|
@distribution = Sidekiq::Undertaker::JobDistributor.new(@dead_jobs).group_by_error_msg
|
41
41
|
@total_dead = @dead_jobs.size
|
42
42
|
|
@@ -46,7 +46,7 @@ module Sidekiq
|
|
46
46
|
def show_undertaker_by_job_class_error_class_error_msg_bucket_name
|
47
47
|
store_request_params
|
48
48
|
|
49
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(
|
49
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
50
50
|
|
51
51
|
# Display dead jobs as list
|
52
52
|
@dead_jobs = @dead_jobs.map(&:job)
|
@@ -55,7 +55,7 @@ module Sidekiq
|
|
55
55
|
|
56
56
|
# Pagination
|
57
57
|
@total_dead = @dead_jobs.size
|
58
|
-
@current_page = (
|
58
|
+
@current_page = (url_params("page") || 1).to_i
|
59
59
|
@count = 50 # per page
|
60
60
|
@dead_jobs = @dead_jobs[((@current_page - 1) * @count), @count]
|
61
61
|
|
@@ -65,18 +65,19 @@ module Sidekiq
|
|
65
65
|
|
66
66
|
# Remove unrelated arguments to allow _paginate url to be clean
|
67
67
|
# Hack to continue to reuse sidekiq's _pagination template
|
68
|
-
|
69
|
-
params.delete("
|
70
|
-
params.delete("
|
71
|
-
params.delete("
|
68
|
+
# FIXME: https://github.com/sidekiq/sidekiq/blob/main/lib/sidekiq/web/action.rb#L64-L67
|
69
|
+
# params.delete("job_class")
|
70
|
+
# params.delete("bucket_name")
|
71
|
+
# params.delete("error_class")
|
72
|
+
# params.delete("error_msg")
|
72
73
|
|
73
74
|
render_result("morgue.erb")
|
74
75
|
end
|
75
76
|
|
76
77
|
def post_undertaker
|
77
|
-
raise ::ArgumentError.new("Key missing") unless
|
78
|
+
raise ::ArgumentError.new("Key missing") unless url_params("key")
|
78
79
|
|
79
|
-
jobs =
|
80
|
+
jobs = url_params("key").map { |k| Sidekiq::DeadSet.new.fetch(*parse_key(k)).first }.compact
|
80
81
|
|
81
82
|
handle_selected_jobs jobs
|
82
83
|
rescue ::ArgumentError
|
@@ -84,11 +85,11 @@ module Sidekiq
|
|
84
85
|
end
|
85
86
|
|
86
87
|
def handle_selected_jobs(jobs)
|
87
|
-
return send_data(*prepare_data(jobs.map(&:item), EXPORT_CHUNK_SIZE)) if
|
88
|
+
return send_data(*prepare_data(jobs.map(&:item), EXPORT_CHUNK_SIZE)) if url_params("export")
|
88
89
|
|
89
|
-
if
|
90
|
+
if url_params("retry")
|
90
91
|
jobs.each(&:retry)
|
91
|
-
elsif
|
92
|
+
elsif url_params("delete")
|
92
93
|
jobs.each(&:delete)
|
93
94
|
end
|
94
95
|
|
@@ -97,7 +98,7 @@ module Sidekiq
|
|
97
98
|
|
98
99
|
def post_undertaker_job_class_error_class_error_msg_bucket_name_delete
|
99
100
|
store_request_params
|
100
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(
|
101
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
101
102
|
@dead_jobs.each do |dead_job|
|
102
103
|
dead_job.job.delete
|
103
104
|
end
|
@@ -108,7 +109,7 @@ module Sidekiq
|
|
108
109
|
def post_undertaker_job_class_error_class_error_msg_bucket_name_retry
|
109
110
|
store_request_params
|
110
111
|
|
111
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(
|
112
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
112
113
|
@dead_jobs.each do |dead_job|
|
113
114
|
dead_job.job.retry
|
114
115
|
end
|
@@ -118,16 +119,15 @@ module Sidekiq
|
|
118
119
|
|
119
120
|
def post_undertaker_job_class_error_class_error_msg_bucket_name_export
|
120
121
|
store_request_params
|
121
|
-
|
122
|
-
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
|
122
|
+
@dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
|
123
123
|
send_data(*prepare_data(@dead_jobs.map { |j| j.job.item }, EXPORT_CHUNK_SIZE))
|
124
124
|
end
|
125
125
|
|
126
126
|
def post_import_jobs
|
127
|
-
file =
|
127
|
+
file = url_params("upload_file")
|
128
128
|
raise ::ArgumentError.new("The file is not a json") if file.nil? || file[:type] != "application/json"
|
129
129
|
|
130
|
-
data =
|
130
|
+
data = url_params("upload_file")[:tempfile].read
|
131
131
|
dead_set = Sidekiq::DeadSet.new
|
132
132
|
|
133
133
|
JSON.parse(data).each do |job|
|
@@ -143,18 +143,29 @@ module Sidekiq
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def store_request_params
|
146
|
-
@
|
147
|
-
@
|
148
|
-
@
|
149
|
-
@
|
150
|
-
end
|
151
|
-
|
152
|
-
def
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
146
|
+
@req_bucket_name = parsed_route_params(:bucket_name)
|
147
|
+
@req_error_class = parsed_route_params(:error_class)
|
148
|
+
@req_error_msg = parsed_route_params(:error_msg)
|
149
|
+
@req_job_class = parsed_route_params(:job_class)
|
150
|
+
end
|
151
|
+
|
152
|
+
def filter_params
|
153
|
+
{
|
154
|
+
"bucket_name" => parsed_route_params(:bucket_name),
|
155
|
+
"error_class" => parsed_route_params(:error_class),
|
156
|
+
"error_msg" => parsed_route_params(:error_msg),
|
157
|
+
"job_class" => parsed_route_params(:job_class)
|
158
|
+
}
|
159
|
+
end
|
160
|
+
|
161
|
+
def parsed_route_params(key)
|
162
|
+
if key == :error_msg
|
163
|
+
msg = route_params(key)
|
164
|
+
msg = Base64.urlsafe_decode64(msg) if !msg.nil? && msg != "all"
|
165
|
+
msg
|
166
|
+
else
|
167
|
+
route_params(key)
|
168
|
+
end
|
158
169
|
end
|
159
170
|
|
160
171
|
def view_path
|
@@ -172,7 +183,7 @@ module Sidekiq
|
|
172
183
|
|
173
184
|
filename = "#{@req_job_class}_#{filename}"
|
174
185
|
zip = Zip::OutputStream.write_buffer do |file|
|
175
|
-
data.each_slice(chunk_size).
|
186
|
+
data.each_slice(chunk_size).with_index do |chunk, index|
|
176
187
|
file.put_next_entry("#{filename}_part-#{index + 1}.json")
|
177
188
|
file.write chunk.to_json
|
178
189
|
end
|
data/lib/sidekiq/undertaker.rb
CHANGED
@@ -10,9 +10,11 @@ rescue LoadError
|
|
10
10
|
end
|
11
11
|
|
12
12
|
if defined?(Sidekiq::Web)
|
13
|
-
Sidekiq::Web.
|
14
|
-
|
15
|
-
|
13
|
+
Sidekiq::Web.configure do |config|
|
14
|
+
config.register(Sidekiq::Undertaker::WebExtension, name: "Undertaker", tab: "Undertaker",
|
15
|
+
index: "undertaker/filter")
|
16
|
+
config.locales << File.join(File.dirname(__FILE__), "../../web/locales")
|
17
|
+
end
|
16
18
|
end
|
17
19
|
|
18
20
|
module Sidekiq
|
data/renovate.json
CHANGED
data/sidekiq-undertaker.gemspec
CHANGED
@@ -27,33 +27,12 @@ Gem::Specification.new do |spec|
|
|
27
27
|
"rubygems_mfa_required" => "true"
|
28
28
|
}
|
29
29
|
|
30
|
-
spec.required_ruby_version = ">= 2.
|
30
|
+
spec.required_ruby_version = ">= 3.2.0"
|
31
31
|
|
32
32
|
spec.files = `git ls-files -z`.split("\x0")
|
33
33
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib", "lib/sidekiq/undertaker"]
|
35
35
|
|
36
|
-
spec.
|
37
|
-
spec.
|
38
|
-
|
39
|
-
spec.add_development_dependency "approvals", "~> 0.0.25"
|
40
|
-
spec.add_development_dependency "mock_redis", "~> 0.19"
|
41
|
-
spec.add_development_dependency "pry", "~> 0.12"
|
42
|
-
spec.add_development_dependency "rack-test", "~> 2.0"
|
43
|
-
spec.add_development_dependency "rb-readline", "~> 0.5"
|
44
|
-
spec.add_development_dependency "rspec", "~> 3.8"
|
45
|
-
spec.add_development_dependency "rspec-core", "~> 3.8"
|
46
|
-
spec.add_development_dependency "rspec-mocks", "~> 3.8"
|
47
|
-
spec.add_development_dependency "rspec-sidekiq", "~> 3.0"
|
48
|
-
spec.add_development_dependency "rt_rubocop_defaults", "~> 2.4"
|
49
|
-
spec.add_development_dependency "rubocop", "~> 1.37"
|
50
|
-
spec.add_development_dependency "rubocop-rake", "~> 0.6"
|
51
|
-
spec.add_development_dependency "rubocop-rspec", "~> 2.14"
|
52
|
-
spec.add_development_dependency "rubocop_runner", "~> 2.2"
|
53
|
-
spec.add_development_dependency "simplecov", "~> 0.21"
|
54
|
-
spec.add_development_dependency "sinatra", "~> 2.0"
|
55
|
-
spec.add_development_dependency "timecop", "~> 0.9"
|
56
|
-
|
57
|
-
spec.add_runtime_dependency "rubyzip", "~> 2.3"
|
58
|
-
spec.add_runtime_dependency "sidekiq", ">= 6.4", "< 8"
|
36
|
+
spec.add_dependency "rubyzip", "~> 2.3"
|
37
|
+
spec.add_dependency "sidekiq", "~> 8"
|
59
38
|
end
|