sidekiq-pool 1.7.0 → 1.7.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
  SHA1:
3
- metadata.gz: 5d233d8baa3f07ed9e51e95b4898ed2026589f3b
4
- data.tar.gz: ba6f24449a22dd14432987fb26b1e6440f7d4655
3
+ metadata.gz: 7a162dd3ea8ea76a7cf305fbff7d91c0f99e61a5
4
+ data.tar.gz: 3a78db0121e97e963b040609e7a7885d57dc460f
5
5
  SHA512:
6
- metadata.gz: fc7c46da9b97173e097b8f5cc1eb54659154f3fc69fde546f589cc07aa8747df3db03c9d60e92f8d573ce4a2313c2a9758cb3f808c8036e246588bf661a5ed03
7
- data.tar.gz: 4f9a284f82b3964665e20df98ef0581b35f5e1e663b88db9b2849fc95807e28227914d24378ed32538ee885bfffeb95f46bf00f5dddda9cc8babde4256e68f96
6
+ metadata.gz: 313c847ff56222ed271b37274ce7339ff2778f38742017fecd8a32a15065aa052c7fe42d0f01008be82342d6ee77f9e2ce10136e234f460cf680a17f371627a7
7
+ data.tar.gz: 77c2f57d9294ccedd64bcd2a8ba032e5ad1d259219f3603e9f475b59a672d4877538a71c160dea4b246e4c1442097e991c9b89122a5aef6b4a2f7853ba66ece3
data/README.md CHANGED
@@ -48,6 +48,16 @@ Signal `HUP` to parent starts new children and then stops old.
48
48
  When using symlinked working directory `working_directory` configuration
49
49
  option must be used to pick up new code.
50
50
 
51
+ ## After fork
52
+
53
+ You may want to execute code after process has been forked. It can be done by registering after_fork hook like this
54
+ ```ruby
55
+ require 'sidekiq/pool'
56
+ Sidekiq::Pool.after_fork do
57
+ # run code here
58
+ end
59
+ ```
60
+
51
61
  ## Contributing
52
62
 
53
63
  Bug reports and pull requests are welcome on GitHub at https://github.com/laurynas/sidekiq-pool.
data/lib/sidekiq/pool.rb CHANGED
@@ -2,5 +2,15 @@ require 'sidekiq/pool/version'
2
2
 
3
3
  module Sidekiq
4
4
  module Pool
5
+ module_function
6
+
7
+ def after_fork(&block)
8
+ @after_fork_hooks ||= []
9
+ @after_fork_hooks << block
10
+ end
11
+
12
+ def after_fork_hooks
13
+ @after_fork_hooks
14
+ end
5
15
  end
6
16
  end
@@ -211,6 +211,7 @@ module Sidekiq
211
211
  @@identity = nil
212
212
  options[:identity] = identity
213
213
 
214
+ run_after_fork_hooks
214
215
  run_child
215
216
  end
216
217
 
@@ -275,6 +276,10 @@ module Sidekiq
275
276
  end
276
277
  end
277
278
 
279
+ def run_after_fork_hooks
280
+ Sidekiq::Pool.after_fork_hooks.each(&:call)
281
+ end
282
+
278
283
  def add_reload_marker
279
284
  return unless options[:pidfile]
280
285
  File.write([options[:pidfile], '.reload'].join, '')
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Pool
3
- VERSION = '1.7.0'
3
+ VERSION = '1.7.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurynas Butkus
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-03 00:00:00.000000000 Z
12
+ date: 2018-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq