angael 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Angael
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -7,16 +7,17 @@ module Angael
7
7
  # # Do something interesting, without raising an exception.
8
8
  # end
9
9
  # You can also add some optional behavior by defining the following methods:
10
- # #after_fork - This is run once, immediately after the child process is forked
11
- # #fork_child - This actually does the forking. You can overwrite this method
12
- # to do wrap the child process in a block. This is useful for
13
- # exception handling. Be sure to actually fork or you may break
14
- # something important.
15
- # #log - If defined, this will be called at various points of interest
16
- # with 1 String as the argument. Log levels are not supported.
17
- # #timeout - Number of seconds to wait for the child process to exit after
18
- # it is sent SIGINT. If you don't define this method, it waits
19
- # 60 seconds.
10
+ # #after_fork - This is run once, immediately after the child process is forked
11
+ # #before_exit - This is run once, immediately before the child process exits
12
+ # #fork_child - This actually does the forking. You can overwrite this method
13
+ # to do wrap the child process in a block. This is useful for
14
+ # exception handling. Be sure to actually fork or you may break
15
+ # something important.
16
+ # #log - If defined, this will be called at various points of interest
17
+ # with 1 String as the argument. Log levels are not supported.
18
+ # #timeout - Number of seconds to wait for the child process to exit after
19
+ # it is sent SIGINT. If you don't define this method, it waits
20
+ # 60 seconds.
20
21
  module Worker
21
22
  include ProcessHelper
22
23
  class ChildProcessNotStoppedError < StandardError; end
@@ -49,6 +50,12 @@ module Angael
49
50
 
50
51
  loop do
51
52
  if @interrupted
53
+ if respond_to?(:before_exit)
54
+ __debug("Running before exit callback")
55
+ before_exit
56
+ __debug("Finished running before exit callback")
57
+ end
58
+
52
59
  __info("Child process exiting gracefully")
53
60
  exit 0
54
61
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: angael
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Cortens