sidekiq-pool 1.9.0 → 2.0.1

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: 5a570cfb2092036b76f35e89ea276f9eb39b7b68645213257a739ae0e7b1d25d
4
- data.tar.gz: 10c418961feaa04d49c0e8c23faefe55c56a4d06a2ea1cf9b57e48958c0ec46d
3
+ metadata.gz: b48af9b55e63a374a5843de9295d3a56faf1e2a7cd8af3120963584818b4be48
4
+ data.tar.gz: 9b3c20e527f34b48da3459037a5a491722f5b6c934288bbbcf1203bb0d7e9100
5
5
  SHA512:
6
- metadata.gz: 8f88af075fa30a0ef809ec9874cd04ee8794015152e118146bda044ea303828426a67c577e3b7cb141849676fe81dec2b6a41e04737e79a39d34ff39f68bec50
7
- data.tar.gz: e2384bb4207be796b44d45f3f83dbed467cdbbb2bb90b33abdb14cf870545d7e096a2fad8e615f8dd9b068bf18eae030ae300b291be16ea27f8856089dd07469
6
+ metadata.gz: 433e5d5109862b240d7bb2fafb211164b2f4394d9ec49e094fb816cbb415be546d5f4c0561ede18665d2037a5c2c09ce4aa8b1d3518bdea9e4920a918965e5ad
7
+ data.tar.gz: c03c4008bfe19ec580f6e0d9f4a5743a6a9451ea6e864e5446657b11e78c0835ea6002ce50112e2344721795f5960cbfcdc06ba520afb94021380712deea2045
@@ -1,4 +1,4 @@
1
- name: Build and release ruby gem
1
+ name: Test, build, and release Ruby gem
2
2
 
3
3
  on:
4
4
  pull_request:
@@ -7,23 +7,42 @@ on:
7
7
  workflow_dispatch:
8
8
 
9
9
  jobs:
10
- build-release-pipeline:
10
+ test:
11
11
  runs-on: ubuntu-latest
12
- container: ruby:2.7.2
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby: [ '2.7', '3.0', '3.1' ]
13
16
  steps:
14
17
  - uses: actions/checkout@v2
18
+ - name: Setup Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
15
23
  - name: Setup
16
- run: |
17
- apt-get update -y && apt-get install -y --no-install-recommends cmake=3.13.4-1
18
- gem install bundler
24
+ run: |
19
25
  bundle install
20
-
21
26
  - name: Test
22
27
  run: bundle exec rake
28
+
29
+ build-release-pipeline:
30
+ runs-on: ubuntu-latest
31
+ needs: test
32
+ if: success() && github.ref == 'refs/heads/master'
33
+ steps:
34
+ - uses: actions/checkout@v2
35
+ - name: Setup Ruby
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: '2.7'
39
+ bundler-cache: true
40
+ - name: Setup
41
+ run: |
42
+ bundle install
23
43
 
24
44
  - name: Build
25
45
  id: build
26
- if: success() && github.ref == 'refs/heads/master'
27
46
  run: |
28
47
  bundle exec rake build
29
48
  echo "::set-output name=gem_version::v$(bundle exec rake version)"
@@ -51,4 +70,3 @@ jobs:
51
70
  ref: "refs/tags/${{ steps.build.outputs.gem_version }}",
52
71
  sha: context.sha
53
72
  })
54
-
data/.gitignore CHANGED
@@ -1,7 +1,5 @@
1
- /.ruby-version
2
1
  /.bundle/
3
2
  /.yardoc
4
- /Gemfile.lock
5
3
  /_yardoc/
6
4
  /coverage/
7
5
  /doc/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.4
data/Gemfile.lock ADDED
@@ -0,0 +1,129 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sidekiq-pool (2.0.1)
5
+ sidekiq (>= 3.0, < 7.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.2)
13
+ coderay (1.1.3)
14
+ connection_pool (2.2.5)
15
+ diff-lcs (1.5.0)
16
+ faraday (1.10.0)
17
+ faraday-em_http (~> 1.0)
18
+ faraday-em_synchrony (~> 1.0)
19
+ faraday-excon (~> 1.1)
20
+ faraday-httpclient (~> 1.0)
21
+ faraday-multipart (~> 1.0)
22
+ faraday-net_http (~> 1.0)
23
+ faraday-net_http_persistent (~> 1.0)
24
+ faraday-patron (~> 1.0)
25
+ faraday-rack (~> 1.0)
26
+ faraday-retry (~> 1.0)
27
+ ruby2_keywords (>= 0.0.4)
28
+ faraday-em_http (1.0.0)
29
+ faraday-em_synchrony (1.0.0)
30
+ faraday-excon (1.1.0)
31
+ faraday-httpclient (1.0.1)
32
+ faraday-multipart (1.0.3)
33
+ multipart-post (>= 1.2, < 3)
34
+ faraday-net_http (1.0.1)
35
+ faraday-net_http_persistent (1.2.0)
36
+ faraday-patron (1.0.0)
37
+ faraday-rack (1.0.0)
38
+ faraday-retry (1.0.3)
39
+ gitlab (4.18.0)
40
+ httparty (~> 0.18)
41
+ terminal-table (>= 1.5.1)
42
+ httparty (0.20.0)
43
+ mime-types (~> 3.0)
44
+ multi_xml (>= 0.5.2)
45
+ method_source (1.0.0)
46
+ mime-types (3.4.1)
47
+ mime-types-data (~> 3.2015)
48
+ mime-types-data (3.2022.0105)
49
+ multi_xml (0.6.0)
50
+ multipart-post (2.1.1)
51
+ octokit (4.22.0)
52
+ faraday (>= 0.9)
53
+ sawyer (~> 0.8.0, >= 0.5.3)
54
+ parallel (1.21.0)
55
+ parser (3.1.1.0)
56
+ ast (~> 2.4.1)
57
+ pronto (0.11.0)
58
+ gitlab (~> 4.4, >= 4.4.0)
59
+ httparty (>= 0.13.7)
60
+ octokit (~> 4.7, >= 4.7.0)
61
+ rainbow (>= 2.2, < 4.0)
62
+ rexml (~> 3.2)
63
+ rugged (>= 0.23.0, < 1.1.0)
64
+ thor (>= 0.20.3, < 2.0)
65
+ pronto-rubocop (0.11.1)
66
+ pronto (~> 0.11.0)
67
+ rubocop (>= 0.63.1, < 2.0)
68
+ pry (0.14.1)
69
+ coderay (~> 1.1)
70
+ method_source (~> 1.0)
71
+ public_suffix (4.0.6)
72
+ rack (2.2.3)
73
+ rainbow (3.1.1)
74
+ rake (13.0.6)
75
+ redis (4.6.0)
76
+ regexp_parser (2.2.1)
77
+ rexml (3.2.5)
78
+ rspec (3.11.0)
79
+ rspec-core (~> 3.11.0)
80
+ rspec-expectations (~> 3.11.0)
81
+ rspec-mocks (~> 3.11.0)
82
+ rspec-core (3.11.0)
83
+ rspec-support (~> 3.11.0)
84
+ rspec-expectations (3.11.0)
85
+ diff-lcs (>= 1.2.0, < 2.0)
86
+ rspec-support (~> 3.11.0)
87
+ rspec-mocks (3.11.0)
88
+ diff-lcs (>= 1.2.0, < 2.0)
89
+ rspec-support (~> 3.11.0)
90
+ rspec-support (3.11.0)
91
+ rubocop (1.26.0)
92
+ parallel (~> 1.10)
93
+ parser (>= 3.1.0.0)
94
+ rainbow (>= 2.2.2, < 4.0)
95
+ regexp_parser (>= 1.8, < 3.0)
96
+ rexml
97
+ rubocop-ast (>= 1.16.0, < 2.0)
98
+ ruby-progressbar (~> 1.7)
99
+ unicode-display_width (>= 1.4.0, < 3.0)
100
+ rubocop-ast (1.16.0)
101
+ parser (>= 3.1.1.0)
102
+ ruby-progressbar (1.11.0)
103
+ ruby2_keywords (0.0.5)
104
+ rugged (1.0.1)
105
+ sawyer (0.8.2)
106
+ addressable (>= 2.3.5)
107
+ faraday (> 0.8, < 2.0)
108
+ sidekiq (6.4.1)
109
+ connection_pool (>= 2.2.2)
110
+ rack (~> 2.0)
111
+ redis (>= 4.2.0)
112
+ terminal-table (3.0.2)
113
+ unicode-display_width (>= 1.1.1, < 3)
114
+ thor (1.2.1)
115
+ unicode-display_width (2.1.0)
116
+
117
+ PLATFORMS
118
+ ruby
119
+
120
+ DEPENDENCIES
121
+ bundler
122
+ pronto-rubocop (~> 0.10)
123
+ pry
124
+ rake (~> 13.0)
125
+ rspec (~> 3.0)
126
+ sidekiq-pool!
127
+
128
+ BUNDLED WITH
129
+ 2.2.33
@@ -11,7 +11,6 @@ module Sidekiq
11
11
  }
12
12
 
13
13
  def initialize
14
- @child_index = 0
15
14
  @pool = []
16
15
  @done = false
17
16
  @system_booted = false
@@ -74,10 +73,12 @@ module Sidekiq
74
73
  boot_system
75
74
 
76
75
  @types = @settings[:workers]
76
+ index = -1
77
77
  @types.each do |type|
78
78
  type[:amount].times do
79
+ index += 1
79
80
  sleep @fork_wait || DEFAULT_FORK_WAIT
80
- fork_child(type[:command])
81
+ fork_child(type[:command], index)
81
82
  end
82
83
  end
83
84
  drop_reload_marker
@@ -194,7 +195,7 @@ module Sidekiq
194
195
  end
195
196
  end
196
197
 
197
- def fork_child(command, wait_for_busy = true)
198
+ def fork_child(command, index, wait_for_busy = true)
198
199
  logger.info "Adding child with args: (#{command}) in #{working_directory}, waiting for busy: #{wait_for_busy}"
199
200
  if working_directory && !Dir.exist?(working_directory)
200
201
  logger.info "Working directory: #{working_directory} does not exist unable to fork"
@@ -207,14 +208,14 @@ module Sidekiq
207
208
  options.merge!(opts)
208
209
 
209
210
  @self_write.close
210
- $0 = 'sidekiq starting'
211
- @child_index += 1
212
- options[:index] = @child_index
211
+ $0 = "sidekiq #{Sidekiq::VERSION} worker #{index} starting"
212
+ options[:index] = index
213
213
 
214
214
  # reset child identity
215
215
  @@process_nonce = nil
216
216
  @@identity = nil
217
217
  options[:identity] = identity
218
+ options[:tag] = "worker #{index}"
218
219
 
219
220
  run_after_fork_hooks
220
221
  run_child
@@ -228,7 +229,7 @@ module Sidekiq
228
229
  sleep 1
229
230
  end if wait_for_busy
230
231
 
231
- @pool << { pid: pid, command: command }
232
+ @pool << { pid: pid, index: index, command: command }
232
233
  end
233
234
 
234
235
  def wait_for_signals
@@ -314,9 +315,9 @@ module Sidekiq
314
315
  end
315
316
 
316
317
  def handle_dead_child(child)
317
- logger.info "Child #{child[:pid]} died"
318
+ logger.info "Child #{child[:pid]} (worker #{child[:index]}) died"
318
319
  @pool.delete(child)
319
- fork_child(child[:command], false)
320
+ fork_child(child[:command], child[:index], false)
320
321
  end
321
322
 
322
323
  def alive?(pid)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Pool
3
- VERSION = '1.9.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinted
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -98,7 +98,9 @@ files:
98
98
  - ".gitignore"
99
99
  - ".rspec"
100
100
  - ".rubocop.yml"
101
+ - ".ruby-version"
101
102
  - Gemfile
103
+ - Gemfile.lock
102
104
  - LICENSE.txt
103
105
  - README.md
104
106
  - Rakefile
@@ -127,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
129
  - !ruby/object:Gem::Version
128
130
  version: '0'
129
131
  requirements: []
130
- rubygems_version: 3.1.4
132
+ rubygems_version: 3.1.6
131
133
  signing_key:
132
134
  specification_version: 4
133
135
  summary: Forks and manages multiple Sidekiq processes