sidekiq-web_custom 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba5e4d42e9ce8e83d27b2ff2a0ca2de8e42d1328f3aa5e8fc9c395d7bbb2dfdf
4
- data.tar.gz: 67b5719e8efe439529a2966bdd555d7807785d20c416e745d32ed439bfa8d161
3
+ metadata.gz: 4b843dd9ee6f1e39c88bea10dacd981c943cce580ae2f8fefa699cc4f98a148c
4
+ data.tar.gz: 822d7ddf7bdff16b66ea2d0259355d98e9abb140e33d89043f2b3fb04aa8de50
5
5
  SHA512:
6
- metadata.gz: 2e477f2deb50b291e55ad812a3d54a2c9b83b5d14b917641f5fe7663a7f8c95c57c9933f95e6bc1d6005fa5abb514018d374c47bc11b7762f9f8ca85d93101bd
7
- data.tar.gz: 3a65411a4af069f947362e1854bdf05af826759a3fab9862cf32a8d5ff2e6a54984459badf0ff8d85dbc9f900f6fd0b1e8d35af887fb139c9d4c8b7c4552cb66
6
+ metadata.gz: 440af8e263e8e989282afa19601b296c11eb370304b37d4e8089c912c9990aae485412627e353132daa772090fc43c2ba62d2a377f8c8cfa265d9b3d31d97a49
7
+ data.tar.gz: 639231fad41d053fc900801985b1650c37c94eb0128e3b72a8825f1ef3c6e3092fabc2b2809f11db453c28e413e6ffbbfbbc7e31c2d0168dc14c8cb3f01c66da
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-byebug'
11
11
  gem "rake", "~> 13.0"
12
12
  gem "rspec", "~> 3.0"
13
13
  gem 'rspec_junit_formatter'
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq-web_custom (0.4.0)
5
- sidekiq (>= 6.0)
4
+ sidekiq-web_custom (0.4.1)
5
+ sidekiq (~> 6.0)
6
6
  timeoutable (>= 1.0)
7
7
 
8
8
  GEM
@@ -69,6 +69,7 @@ GEM
69
69
  zeitwerk (~> 2.3)
70
70
  builder (3.2.4)
71
71
  byebug (11.1.3)
72
+ coderay (1.1.3)
72
73
  concurrent-ruby (1.1.9)
73
74
  connection_pool (2.2.5)
74
75
  crass (1.0.6)
@@ -91,6 +92,12 @@ GEM
91
92
  nio4r (2.5.7)
92
93
  nokogiri (1.11.7-x86_64-linux)
93
94
  racc (~> 1.4)
95
+ pry (0.13.1)
96
+ coderay (~> 1.1)
97
+ method_source (~> 1.0)
98
+ pry-byebug (3.9.0)
99
+ byebug (~> 11.0)
100
+ pry (~> 0.13.0)
94
101
  racc (1.5.2)
95
102
  rack (2.2.3)
96
103
  rack-test (1.1.0)
@@ -122,7 +129,7 @@ GEM
122
129
  rake (>= 0.8.7)
123
130
  thor (~> 1.0)
124
131
  rake (13.0.3)
125
- redis (4.3.1)
132
+ redis (4.6.0)
126
133
  rspec (3.10.0)
127
134
  rspec-core (~> 3.10.0)
128
135
  rspec-expectations (~> 3.10.0)
@@ -138,7 +145,7 @@ GEM
138
145
  rspec-support (3.10.2)
139
146
  rspec_junit_formatter (0.4.1)
140
147
  rspec-core (>= 2, < 4, != 2.12.0)
141
- sidekiq (6.2.1)
148
+ sidekiq (6.4.1)
142
149
  connection_pool (>= 2.2.2)
143
150
  rack (~> 2.0)
144
151
  redis (>= 4.2.0)
@@ -156,8 +163,8 @@ GEM
156
163
  activesupport (>= 4.0)
157
164
  sprockets (>= 3.0.0)
158
165
  thor (1.1.0)
159
- timeout (0.1.1)
160
- timeoutable (1.0.0)
166
+ timeout (0.2.0)
167
+ timeoutable (1.1.1)
161
168
  timeout
162
169
  tzinfo (2.0.4)
163
170
  concurrent-ruby (~> 1.0)
@@ -170,7 +177,7 @@ PLATFORMS
170
177
  x86_64-linux
171
178
 
172
179
  DEPENDENCIES
173
- byebug
180
+ pry-byebug
174
181
  rails
175
182
  rake (~> 13.0)
176
183
  rspec (~> 3.0)
@@ -4,7 +4,7 @@ module Sidekiq
4
4
  module WebCustom
5
5
  MAJOR = 0 # With backwards incompatability. Requires annoucment and update documentation
6
6
  MINOR = 4 # 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
7
+ PATCH = 1 # 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")
@@ -84,11 +84,15 @@ module Sidekiq
84
84
  @__already_called = true
85
85
  ::Sidekiq::WebAction.prepend WebAction
86
86
  ::Sidekiq::Queue.prepend Queue
87
- ::Sidekiq::Job.prepend Job
87
+
88
+ if ::Sidekiq::VERSION >= "6.4.0"
89
+ ::Sidekiq::JobRecord.prepend Job
90
+ else
91
+ ::Sidekiq::Job.prepend Job
92
+ end
93
+
88
94
  ::Sidekiq::Web.register WebApp
89
95
  end
90
96
  end
91
97
  end
92
98
 
93
- # dependent the error classes loaded on boot, requie after code is loaded
94
- require 'sidekiq/web_custom/timeout'
@@ -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.0'
37
37
  spec.add_dependency 'timeoutable', '>= 1.0'
38
38
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-web_custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
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-09-04 00:00:00.000000000 Z
11
+ date: 2022-04-09 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
19
  version: '6.0'
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
26
  version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -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
@@ -147,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
146
  - !ruby/object:Gem::Version
148
147
  version: '0'
149
148
  requirements: []
150
- rubygems_version: 3.2.22
149
+ rubygems_version: 3.2.32
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