sidekiq-web_custom 0.3.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33751169bc37e3ce515c82a40cceef962731d790aa317a9637b18914a46190a3
4
- data.tar.gz: 91eb14067a2e743cc3022cea2147958210db08bfb29c51ce0fd7949ae3781780
3
+ metadata.gz: 815bd23151114eb4c72a9f191c8038a394a8f3dd50b8209eb11cd1df03a70246
4
+ data.tar.gz: 3be935aeb2523cbe18febb5f1e173bb4b5fe8c1e9cad07f1a2338d4a81010e0a
5
5
  SHA512:
6
- metadata.gz: fb1ffa2cc81485ae694b25fc0f24bbe963cc3cbba4868014ca726ac310247d1b24bab5faf8650c55cb16a0aa0d61ec2f3ba733767a453eb0b66d5267328311f5
7
- data.tar.gz: c209d5562abc1426237b51290dac6e5575b4c0ea63241758795d42f061f1c0130c158fbbe320453e68a632a479af59f9dbf5e2d053cda1b0c42631ffe196a57c
6
+ metadata.gz: b3f0257f49ef4d2170e50923489f70404d792ede869b3298f415b3c9d56f32edb5d9564adb2c50ab9e319598752f19a1515531901f8f357754111ea23a042887
7
+ data.tar.gz: dceab9cddad2591ddc1d9ba657c0958443684616557bd0c51653996369c415ba7911119bf9a20a7f5d9f7a8e8a85145654eba59a5e6920fc5c1f4e3f17f0364c
data/.circleci/config.yml CHANGED
@@ -2,103 +2,27 @@ version: 2.1
2
2
 
3
3
  orbs:
4
4
  ruby: circleci/ruby@1.0
5
-
6
- jobs:
7
- build:
8
- docker:
9
- - image: cimg/ruby:2.7-node
10
- steps:
11
- - checkout
12
- - ruby/install-deps
13
- environment:
14
- publish-rubygems:
15
- docker:
16
- - image: cimg/ruby:2.7-node # this is our primary docker image, where step commands run.
17
- environment:
18
- BUNDLE_JOBS: "3"
19
- BUNDLE_RETRY: "3"
20
- RAILS_ENV: test
21
- steps:
22
- - checkout
23
- - ruby/install-deps
24
- - run:
25
- name: Publish Ruby Gems
26
- command: |
27
- bin/publish_ruby_gems
28
- publish-github:
29
- docker:
30
- - image: cimg/ruby:2.7-node
31
- environment:
32
- BUNDLE_JOBS: "3"
33
- BUNDLE_RETRY: "3"
34
- RAILS_ENV: test
35
- steps:
36
- - checkout
37
- - ruby/install-deps
38
- - run:
39
- name: 'Get Go'
40
- command: |
41
- sudo apt-get update -qq
42
- sudo apt-get -y --no-install-recommends install golang-go
43
- - run:
44
- name: 'Set Git stats'
45
- command: |
46
- git config user.name $GITHUB_USER
47
- git config user.email $GITHUB_EMAIL
48
- - run:
49
- name: 'Download GHR'
50
- command: |
51
- curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xz -f - -C . ghr_v0.13.0_linux_amd64/ghr
52
- mv ghr_v0.13.0_linux_amd64/ghr .
53
- rm -rf ghr_v0.13.0_linux_amd64
54
- chmod 0755 ghr
55
- - run:
56
- name: Publish Git
57
- command: |
58
- export GHRLOCATION=ghr
59
- bin/publish_git
60
- test:
61
- docker:
62
- - image: cimg/ruby:2.7-node
63
- - image: circleci/redis:latest
64
- environment:
65
- BUNDLE_JOBS: "3"
66
- BUNDLE_RETRY: "3"
67
- RAILS_ENV: test
68
- # A series of steps to run, some are similar to those in "build".
69
- steps:
70
- - checkout
71
- - ruby/install-deps
72
- - run:
73
- name: Setup Climate Control test-reporter
74
- command: |
75
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
76
- chmod +x ./cc-test-reporter
77
- - run:
78
- name: Run le tests
79
- command: |
80
- ./cc-test-reporter before-build
81
- SIMPLE_COV_RUN=true bundle exec rspec --format RspecJunitFormatter --out test-results/rspec/rspec.xml --format progress --color
82
- ./cc-test-reporter after-build format-coverage -t simplecov
5
+ node: circleci/node@2
6
+ cst: cst/framework@1
83
7
 
84
8
  workflows:
85
9
  version: 2
86
10
  yeet-le-jobs:
87
11
  jobs:
88
- - build
89
- - test:
90
- requires:
91
- - build
92
- - publish-github:
93
- requires:
94
- - test
95
- filters:
96
- branches:
97
- only:
98
- - main
99
- - publish-rubygems:
12
+ - cst/enforce-gem-version-bump
13
+ - cst/rspec-ruby:
14
+ rspec-system-args: "SIMPLE_COV_RUN=true"
15
+ cc-report-collect-ruby: "2.7.5"
16
+ matrix:
17
+ parameters:
18
+ ruby-version: ["2.7.5" , "3.0.0", "3.0.3"]
19
+ alias: required-matrix-tests
20
+ name: test-ruby<< matrix.ruby-version >>
21
+ - cst/publish-gem:
22
+ publish-git: true
23
+ publish-default-gem: true
100
24
  requires:
101
- - test
25
+ - required-matrix-tests
102
26
  filters:
103
27
  branches:
104
28
  only:
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:2.5.5
1
+ FROM ruby:2.7.5
2
2
  RUN cd /tmp && curl -L --output ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_amd64.tar.gz && \
3
3
  tar -xzvf ghr.tar.gz && chmod +x ghr_v0.12.0_linux_amd64/ghr && mv ghr_v0.12.0_linux_amd64/ghr /usr/local/bin/ghr && rm -rf /tmp/*
4
4
 
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
 
9
9
  gem 'rails'
10
- gem 'byebug'
10
+ gem 'pry'
11
11
  gem "rake", "~> 13.0"
12
12
  gem "rspec", "~> 3.0"
13
13
  gem 'rspec_junit_formatter'
data/Gemfile.lock CHANGED
@@ -1,176 +1,194 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq-web_custom (0.3.1)
5
- sidekiq (>= 6.0)
4
+ sidekiq-web_custom (0.4.1)
5
+ sidekiq (~> 6.5)
6
6
  timeoutable (>= 1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.3.2)
12
- actionpack (= 6.1.3.2)
13
- activesupport (= 6.1.3.2)
11
+ actioncable (7.0.3.1)
12
+ actionpack (= 7.0.3.1)
13
+ activesupport (= 7.0.3.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.3.2)
17
- actionpack (= 6.1.3.2)
18
- activejob (= 6.1.3.2)
19
- activerecord (= 6.1.3.2)
20
- activestorage (= 6.1.3.2)
21
- activesupport (= 6.1.3.2)
16
+ actionmailbox (7.0.3.1)
17
+ actionpack (= 7.0.3.1)
18
+ activejob (= 7.0.3.1)
19
+ activerecord (= 7.0.3.1)
20
+ activestorage (= 7.0.3.1)
21
+ activesupport (= 7.0.3.1)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.3.2)
24
- actionpack (= 6.1.3.2)
25
- actionview (= 6.1.3.2)
26
- activejob (= 6.1.3.2)
27
- activesupport (= 6.1.3.2)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.0.3.1)
27
+ actionpack (= 7.0.3.1)
28
+ actionview (= 7.0.3.1)
29
+ activejob (= 7.0.3.1)
30
+ activesupport (= 7.0.3.1)
28
31
  mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
29
35
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.3.2)
31
- actionview (= 6.1.3.2)
32
- activesupport (= 6.1.3.2)
33
- rack (~> 2.0, >= 2.0.9)
36
+ actionpack (7.0.3.1)
37
+ actionview (= 7.0.3.1)
38
+ activesupport (= 7.0.3.1)
39
+ rack (~> 2.0, >= 2.2.0)
34
40
  rack-test (>= 0.6.3)
35
41
  rails-dom-testing (~> 2.0)
36
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.3.2)
38
- actionpack (= 6.1.3.2)
39
- activerecord (= 6.1.3.2)
40
- activestorage (= 6.1.3.2)
41
- activesupport (= 6.1.3.2)
43
+ actiontext (7.0.3.1)
44
+ actionpack (= 7.0.3.1)
45
+ activerecord (= 7.0.3.1)
46
+ activestorage (= 7.0.3.1)
47
+ activesupport (= 7.0.3.1)
48
+ globalid (>= 0.6.0)
42
49
  nokogiri (>= 1.8.5)
43
- actionview (6.1.3.2)
44
- activesupport (= 6.1.3.2)
50
+ actionview (7.0.3.1)
51
+ activesupport (= 7.0.3.1)
45
52
  builder (~> 3.1)
46
53
  erubi (~> 1.4)
47
54
  rails-dom-testing (~> 2.0)
48
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.3.2)
50
- activesupport (= 6.1.3.2)
56
+ activejob (7.0.3.1)
57
+ activesupport (= 7.0.3.1)
51
58
  globalid (>= 0.3.6)
52
- activemodel (6.1.3.2)
53
- activesupport (= 6.1.3.2)
54
- activerecord (6.1.3.2)
55
- activemodel (= 6.1.3.2)
56
- activesupport (= 6.1.3.2)
57
- activestorage (6.1.3.2)
58
- actionpack (= 6.1.3.2)
59
- activejob (= 6.1.3.2)
60
- activerecord (= 6.1.3.2)
61
- activesupport (= 6.1.3.2)
62
- marcel (~> 1.0.0)
63
- mini_mime (~> 1.0.2)
64
- activesupport (6.1.3.2)
59
+ activemodel (7.0.3.1)
60
+ activesupport (= 7.0.3.1)
61
+ activerecord (7.0.3.1)
62
+ activemodel (= 7.0.3.1)
63
+ activesupport (= 7.0.3.1)
64
+ activestorage (7.0.3.1)
65
+ actionpack (= 7.0.3.1)
66
+ activejob (= 7.0.3.1)
67
+ activerecord (= 7.0.3.1)
68
+ activesupport (= 7.0.3.1)
69
+ marcel (~> 1.0)
70
+ mini_mime (>= 1.1.0)
71
+ activesupport (7.0.3.1)
65
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
73
  i18n (>= 1.6, < 2)
67
74
  minitest (>= 5.1)
68
75
  tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
76
  builder (3.2.4)
71
- byebug (11.1.3)
72
- concurrent-ruby (1.1.9)
77
+ coderay (1.1.3)
78
+ concurrent-ruby (1.1.10)
73
79
  connection_pool (2.2.5)
74
80
  crass (1.0.6)
75
- diff-lcs (1.4.4)
81
+ diff-lcs (1.5.0)
82
+ digest (3.1.0)
76
83
  docile (1.4.0)
77
- erubi (1.10.0)
78
- globalid (0.4.2)
79
- activesupport (>= 4.2.0)
80
- i18n (1.8.10)
84
+ erubi (1.11.0)
85
+ globalid (1.0.0)
86
+ activesupport (>= 5.0)
87
+ i18n (1.12.0)
81
88
  concurrent-ruby (~> 1.0)
82
- loofah (2.10.0)
89
+ loofah (2.18.0)
83
90
  crass (~> 1.0.2)
84
91
  nokogiri (>= 1.5.9)
85
92
  mail (2.7.1)
86
93
  mini_mime (>= 0.1.1)
87
- marcel (1.0.1)
94
+ marcel (1.0.2)
88
95
  method_source (1.0.0)
89
- mini_mime (1.0.3)
90
- minitest (5.14.4)
91
- nio4r (2.5.7)
92
- nokogiri (1.11.7-x86_64-linux)
96
+ mini_mime (1.1.2)
97
+ minitest (5.16.3)
98
+ net-imap (0.2.3)
99
+ digest
100
+ net-protocol
101
+ strscan
102
+ net-pop (0.1.1)
103
+ digest
104
+ net-protocol
105
+ timeout
106
+ net-protocol (0.1.3)
107
+ timeout
108
+ net-smtp (0.3.1)
109
+ digest
110
+ net-protocol
111
+ timeout
112
+ nio4r (2.5.8)
113
+ nokogiri (1.13.8-x86_64-linux)
93
114
  racc (~> 1.4)
94
- racc (1.5.2)
95
- rack (2.2.3)
96
- rack-test (1.1.0)
97
- rack (>= 1.0, < 3)
98
- rails (6.1.3.2)
99
- actioncable (= 6.1.3.2)
100
- actionmailbox (= 6.1.3.2)
101
- actionmailer (= 6.1.3.2)
102
- actionpack (= 6.1.3.2)
103
- actiontext (= 6.1.3.2)
104
- actionview (= 6.1.3.2)
105
- activejob (= 6.1.3.2)
106
- activemodel (= 6.1.3.2)
107
- activerecord (= 6.1.3.2)
108
- activestorage (= 6.1.3.2)
109
- activesupport (= 6.1.3.2)
115
+ pry (0.14.1)
116
+ coderay (~> 1.1)
117
+ method_source (~> 1.0)
118
+ racc (1.6.0)
119
+ rack (2.2.4)
120
+ rack-test (2.0.2)
121
+ rack (>= 1.3)
122
+ rails (7.0.3.1)
123
+ actioncable (= 7.0.3.1)
124
+ actionmailbox (= 7.0.3.1)
125
+ actionmailer (= 7.0.3.1)
126
+ actionpack (= 7.0.3.1)
127
+ actiontext (= 7.0.3.1)
128
+ actionview (= 7.0.3.1)
129
+ activejob (= 7.0.3.1)
130
+ activemodel (= 7.0.3.1)
131
+ activerecord (= 7.0.3.1)
132
+ activestorage (= 7.0.3.1)
133
+ activesupport (= 7.0.3.1)
110
134
  bundler (>= 1.15.0)
111
- railties (= 6.1.3.2)
112
- sprockets-rails (>= 2.0.0)
135
+ railties (= 7.0.3.1)
113
136
  rails-dom-testing (2.0.3)
114
137
  activesupport (>= 4.2.0)
115
138
  nokogiri (>= 1.6)
116
- rails-html-sanitizer (1.3.0)
139
+ rails-html-sanitizer (1.4.3)
117
140
  loofah (~> 2.3)
118
- railties (6.1.3.2)
119
- actionpack (= 6.1.3.2)
120
- activesupport (= 6.1.3.2)
141
+ railties (7.0.3.1)
142
+ actionpack (= 7.0.3.1)
143
+ activesupport (= 7.0.3.1)
121
144
  method_source
122
- rake (>= 0.8.7)
145
+ rake (>= 12.2)
123
146
  thor (~> 1.0)
124
- rake (13.0.3)
125
- redis (4.3.1)
126
- rspec (3.10.0)
127
- rspec-core (~> 3.10.0)
128
- rspec-expectations (~> 3.10.0)
129
- rspec-mocks (~> 3.10.0)
130
- rspec-core (3.10.1)
131
- rspec-support (~> 3.10.0)
132
- rspec-expectations (3.10.1)
147
+ zeitwerk (~> 2.5)
148
+ rake (13.0.6)
149
+ redis (4.7.1)
150
+ rspec (3.11.0)
151
+ rspec-core (~> 3.11.0)
152
+ rspec-expectations (~> 3.11.0)
153
+ rspec-mocks (~> 3.11.0)
154
+ rspec-core (3.11.0)
155
+ rspec-support (~> 3.11.0)
156
+ rspec-expectations (3.11.0)
133
157
  diff-lcs (>= 1.2.0, < 2.0)
134
- rspec-support (~> 3.10.0)
135
- rspec-mocks (3.10.2)
158
+ rspec-support (~> 3.11.0)
159
+ rspec-mocks (3.11.1)
136
160
  diff-lcs (>= 1.2.0, < 2.0)
137
- rspec-support (~> 3.10.0)
138
- rspec-support (3.10.2)
139
- rspec_junit_formatter (0.4.1)
161
+ rspec-support (~> 3.11.0)
162
+ rspec-support (3.11.0)
163
+ rspec_junit_formatter (0.5.1)
140
164
  rspec-core (>= 2, < 4, != 2.12.0)
141
- sidekiq (6.2.1)
165
+ sidekiq (6.5.4)
142
166
  connection_pool (>= 2.2.2)
143
167
  rack (~> 2.0)
144
- redis (>= 4.2.0)
168
+ redis (>= 4.5.0)
145
169
  simplecov (0.21.2)
146
170
  docile (~> 1.1)
147
171
  simplecov-html (~> 0.11)
148
172
  simplecov_json_formatter (~> 0.1)
149
173
  simplecov-html (0.12.3)
150
- simplecov_json_formatter (0.1.3)
151
- sprockets (4.0.2)
152
- concurrent-ruby (~> 1.0)
153
- rack (> 1, < 3)
154
- sprockets-rails (3.2.2)
155
- actionpack (>= 4.0)
156
- activesupport (>= 4.0)
157
- sprockets (>= 3.0.0)
158
- thor (1.1.0)
159
- timeout (0.1.1)
160
- timeoutable (1.0.0)
174
+ simplecov_json_formatter (0.1.4)
175
+ strscan (3.0.4)
176
+ thor (1.2.1)
177
+ timeout (0.3.0)
178
+ timeoutable (1.1.1)
161
179
  timeout
162
- tzinfo (2.0.4)
180
+ tzinfo (2.0.5)
163
181
  concurrent-ruby (~> 1.0)
164
182
  websocket-driver (0.7.5)
165
183
  websocket-extensions (>= 0.1.0)
166
184
  websocket-extensions (0.1.5)
167
- zeitwerk (2.4.2)
185
+ zeitwerk (2.6.0)
168
186
 
169
187
  PLATFORMS
170
188
  x86_64-linux
171
189
 
172
190
  DEPENDENCIES
173
- byebug
191
+ pry
174
192
  rails
175
193
  rake (~> 13.0)
176
194
  rspec (~> 3.0)
@@ -179,4 +197,4 @@ DEPENDENCIES
179
197
  simplecov
180
198
 
181
199
  BUNDLED WITH
182
- 2.2.19
200
+ 2.3.20
data/README.md CHANGED
@@ -9,10 +9,8 @@ This Custom add on to the Sidekiq Web framework allows you to continue to drain
9
9
  ## Installation
10
10
 
11
11
  Add this line to your application's Gemfile:
12
-
13
- Working on Adding a gem source. For now directly pull it from git
14
12
  ```ruby
15
- gem 'sidekiq-web_custom', source: 'https://github.com/matt-taylor/sidekiq-web_custom'
13
+ gem 'sidekiq-web_custom'
16
14
  ```
17
15
 
18
16
  And then execute:
@@ -5,7 +5,6 @@ require 'action_mailer/railtie'
5
5
  require 'sprockets/railtie'
6
6
  require 'rails/test_unit/railtie'
7
7
 
8
- require 'byebug'
9
8
  Bundler.require(*Rails.groups)
10
9
  require 'sidekiq/web_custom'
11
10
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'byebug'
4
-
5
3
  worker_files = Dir[Rails.root.join('app','workers','**','*_worker.rb').to_s]
6
4
  require_workers = worker_files.map { |path| File.basename(path, '.rb') }
7
5
  require_workers.each do |worker|
@@ -4,49 +4,50 @@ module Sidekiq
4
4
  module WebCustom
5
5
  class Processor < ::Sidekiq::Processor
6
6
 
7
- def self.execute(max:, queue:, options: Sidekiq.options)
7
+ def self.execute(max:, queue:, options: Sidekiq)
8
8
  __processor__(queue: queue, options: options).__execute(max: max)
9
9
  end
10
10
 
11
- def self.execute_job(job:, options: Sidekiq.options)
11
+ def self.execute_job(job:, options: Sidekiq)
12
12
  __processor__(queue: job.queue, options: options).__execute_job(job: job)
13
13
  rescue StandardError => _
14
14
  false # error gets loggged downstream
15
15
  end
16
16
 
17
- def self.__processor__(queue:, options: Sidekiq.options)
18
- options_temp = options.clone
17
+ def self.__processor__(queue:, options: Sidekiq)
18
+ options_temp = options.dup
19
19
  queue = queue.is_a?(String) ? Sidekiq::Queue.new(queue) : queue
20
20
 
21
21
  options_temp[:queues] = [queue.name]
22
22
  klass = options_temp[:fetch]&.class || BasicFetch
23
23
  options_temp[:fetch] = klass.new(options_temp)
24
- new(manager: nil, options: options_temp, queue: queue)
24
+
25
+ new(options: options_temp, queue: queue)
25
26
  end
26
27
 
27
- def initialize(manager:, options:, queue:)
28
+ def initialize(options:, queue:)
28
29
  @__queue = queue
29
30
  @__basic_fetch = options[:fetch].class == BasicFetch
30
31
 
31
- super(manager, options)
32
+ super(options)
32
33
  end
33
34
 
34
35
  def __execute_job(job:)
35
36
  queue_name = "queue:#{job.queue}"
36
37
  work_unit = Sidekiq::BasicFetch::UnitOfWork.new(queue_name, job.item.to_json)
37
38
  begin
38
- Sidekiq.logger.info "Manually processing individual work unit for #{work_unit.queue_name}"
39
+ logger.info "Manually processing individual work unit for #{work_unit.queue_name}"
39
40
  process(work_unit)
40
41
  rescue StandardError => e
41
- Sidekiq.logger.error "Manually processed work unit failed with #{e.message}. Work unit will not be dequeued"
42
+ logger.error "Manually processed work unit failed with #{e.message}. Work unit will not be dequeued"
42
43
  raise e
43
44
  end
44
45
 
45
46
  begin
46
47
  job.delete
47
- Sidekiq.logger.info { "Manually processed work unit sucessfully dequeued." }
48
+ logger.info { "Manually processed work unit sucessfully dequeued." }
48
49
  rescue StandardError => e
49
- Sidekiq.logger.fatal "Manually processed work unit failed to be dequeued. #{e.message}."
50
+ logger.fatal "Manually processed work unit failed to be dequeued. #{e.message}."
50
51
  raise e
51
52
  end
52
53
 
@@ -59,21 +60,21 @@ module Sidekiq
59
60
  break if @__queue.size <= 0
60
61
 
61
62
  if Thread.current[Sidekiq::WebCustom::BREAK_BIT]
62
- Sidekiq.logger.warn "Yikes -- Break bit has been set. Attempting to return in time. Completed #{count} of attempted #{max}"
63
+ logger.warn "Yikes -- Break bit has been set. Attempting to return in time. Completed #{count} of attempted #{max}"
63
64
  break
64
65
  end
65
66
 
66
- Sidekiq.logger.info { "Manually processing next item in queue:[#{@__queue.name}]" }
67
+ logger.info { "Manually processing next item in queue:[#{@__queue.name}]" }
67
68
  process_one
68
69
  count += 1
69
-
70
70
  end
71
+
71
72
  count
72
73
  rescue Exception => ex
73
74
  if @job && @__basic_fetch
74
- Sidekiq.logger.fatal "Processor Execution interrupted. Lost Job #{@job.job}"
75
+ logger.fatal "Processor Execution interrupted. Lost Job #{@job.job}"
75
76
  end
76
- Sidekiq.logger.warn "Manual execution has terminated. Received error [#{ex.message}]"
77
+ logger.warn "Manual execution has terminated. Received error [#{ex.message}]"
77
78
  return count
78
79
  end
79
80
  end
@@ -3,8 +3,8 @@
3
3
  module Sidekiq
4
4
  module WebCustom
5
5
  MAJOR = 0 # With backwards incompatability. Requires annoucment and update documentation
6
- MINOR = 3 # With feature launch. Documentation of upgrade is useful via a changelog
7
- PATCH = 1 # With minor upgrades or patcing a small bug. No changelog necessary
6
+ MINOR = 5 # With feature launch. Documentation of upgrade is useful via a changelog
7
+ PATCH = 0 # With minor upgrades or patcing a small bug. No changelog necessary
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.get_version
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timeoutable'
4
+
3
5
  module Sidekiq
4
6
  module WebCustom
5
7
  class WebApp
@@ -15,7 +17,7 @@ module Sidekiq
15
17
  proc: ->(thread, seconds) { thread[Sidekiq::WebCustom::BREAK_BIT] = 1; Sidekiq.logger.warn "set bit #{thread[Sidekiq::WebCustom::BREAK_BIT]}" }
16
18
  }
17
19
  Thread.current[Sidekiq::WebCustom::BREAK_BIT] = nil
18
- Sidekiq::WebCustom::Timeout.timeout(timeout_params) do
20
+ ::Timeoutable.timeout(**timeout_params) do
19
21
  Sidekiq::Queue.new(params[:name]).drain(max: Sidekiq::WebCustom.config.drain_rate)
20
22
  end
21
23
  redirect_with_query("#{root_path}queues")
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'byebug'
4
3
  require_relative 'web_custom/version'
5
4
 
6
5
  # require sidekiq/web first to ensure web_Action will prepend correctly
@@ -85,11 +84,10 @@ module Sidekiq
85
84
  @__already_called = true
86
85
  ::Sidekiq::WebAction.prepend WebAction
87
86
  ::Sidekiq::Queue.prepend Queue
88
- ::Sidekiq::Job.prepend Job
87
+ ::Sidekiq::JobRecord.prepend Job
88
+
89
89
  ::Sidekiq::Web.register WebApp
90
90
  end
91
91
  end
92
92
  end
93
93
 
94
- # dependent the error classes loaded on boot, requie after code is loaded
95
- require 'sidekiq/web_custom/timeout'
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  DOC
17
17
  spec.homepage = "https://github.com/matt-taylor/sidekiq-web_custom"
18
18
  spec.license = "MIT"
19
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
19
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
20
20
 
21
21
  # spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
22
22
 
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
34
  spec.require_paths = ["lib"]
35
35
 
36
- spec.add_dependency 'sidekiq', '>= 6.0'
36
+ spec.add_dependency 'sidekiq', '~> 6.5'
37
37
  spec.add_dependency 'timeoutable', '>= 1.0'
38
38
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-web_custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Taylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2022-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '6.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '6.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: timeoutable
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,6 @@ files:
120
120
  - lib/sidekiq/web_custom/job.rb
121
121
  - lib/sidekiq/web_custom/processor.rb
122
122
  - lib/sidekiq/web_custom/queue.rb
123
- - lib/sidekiq/web_custom/timeout.rb
124
123
  - lib/sidekiq/web_custom/version.rb
125
124
  - lib/sidekiq/web_custom/web_action.rb
126
125
  - lib/sidekiq/web_custom/web_app.rb
@@ -140,14 +139,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
139
  requirements:
141
140
  - - ">="
142
141
  - !ruby/object:Gem::Version
143
- version: 2.4.0
142
+ version: '2.7'
144
143
  required_rubygems_version: !ruby/object:Gem::Requirement
145
144
  requirements:
146
145
  - - ">="
147
146
  - !ruby/object:Gem::Version
148
147
  version: '0'
149
148
  requirements: []
150
- rubygems_version: 3.2.15
149
+ rubygems_version: 3.3.11
151
150
  signing_key:
152
151
  specification_version: 4
153
152
  summary: This gem adds on custom capabilities to the Sidekiq Web UI
@@ -1,64 +0,0 @@
1
- module Sidekiq
2
- module WebCustom
3
- module Timeout
4
- module_function
5
- DEFAULT_EXCEPTION = Sidekiq::WebCustom::ExecutionTimeExceeded
6
- PROC = Proc.new do |warn_sec, timeout_sec, proc, exception, message, debug, &block|
7
- puts "at: PROC; begining" if debug
8
-
9
- sec_to_raise = timeout_sec - warn_sec
10
- begin
11
- from = debug ? "from #{caller_locations(1, 1)[0]}" : nil
12
- x = Thread.current
13
- # do everything in a new thread
14
- y = Thread.start {
15
- puts "at: PROC; second thread; about to start" if debug
16
- Thread.current.name = from
17
- # block for warning in new thread
18
- begin
19
- puts "at: PROC; second thread; starting warn time for #{warn_sec}'s " if debug
20
- sleep warn_sec
21
- rescue => e
22
- x.raise e
23
- else
24
- # yield back during warning time so downstream can do some prep work
25
- puts "at: PROC; second thread; trying to warn in main thread" if debug
26
- proc.call(x, warn_sec)
27
- end
28
-
29
- # block additional seconds to raise for
30
- begin
31
- puts "at: PROC; second thread; starting violent exection time for #{sec_to_raise}'s " if debug
32
- sleep sec_to_raise
33
- rescue => e
34
- puts "at: PROC; second thread; Error occured" if debug
35
- x.raise e
36
- else
37
- puts "at: PROC; second thread; trying to raise in main thread" if debug
38
- x.raise exception, message
39
- end
40
- }
41
- puts "at: PROC; second thread; fully spooled" if debug
42
- # after thread starts, yield back to calle function with max timout
43
- block.call(timeout_sec)
44
- ensure
45
- if y
46
- puts "at: PROC; Second thread still exists. Returned in time" if debug
47
- y.kill
48
- y.join
49
- else
50
- puts "at: PROC; Second thread no longer exists. Failed to return in time" if debug
51
- end
52
- end
53
- end
54
-
55
- def timeout(warn:, timeout:, proc: ->(_, _) {}, exception: DEFAULT_EXCEPTION, message: nil, debug: false, &block)
56
- raise Sidekiq::WebCustom::ArgumentError, 'Block not given' unless block_given?
57
-
58
- puts "at: timeout; valid bock given" if debug
59
- message ||= "Execution exceeded #{timeout} seconds." if debug
60
- PROC.call(warn, timeout, proc, exception, message, debug, &block)
61
- end
62
- end
63
- end
64
- end