process_settings 0.18.0.pre.1 → 0.18.0

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: 15a15a0c5c7ea497858038e4b4be06e63aea209c8e3033662c28963d19839d39
4
- data.tar.gz: ba4e23e5216b60ecc7e5e999dcac7d1679c90fd2cf6b712624da9a04aa629c1a
3
+ metadata.gz: aab773e1074ed3b357a5938e9366b56e69bdc6e36ace59835fdea8bbbe49516d
4
+ data.tar.gz: 3fe8bb70b1e59498420c878abb86cf2e1b0289694e4ed941a0a11b1a6abc5bce
5
5
  SHA512:
6
- metadata.gz: 44058ab68dbb74cdf889bd57ac0bff0324f35f4608a27f67623da3b17a8ee0b4f9bfef24311395e969f941db28c2a5137c79c3233db75659fcc9e1f4239797e1
7
- data.tar.gz: 3310afc60c343999207561d0e2820dc6ff4e985f71b1e25b8402fe7f3f39c762dd560f83cf78a5ccd57fa937a13c9dfdb43f41e57e8aa3326eb3a63d05f628bd
6
+ metadata.gz: 939389ccdfaf3fb4880251e34abc36f15e11963ef1ce69e102208a04e084df0c870eeb906103f9859d6ce7af1e27938d713e153ab16768ee6bbaf0e6c6bb5262
7
+ data.tar.gz: bf6190c8812f0fcb73507bfc4b1cda3e2f9370e5c398df8cdbda2a112a23c80479dcf7189d8fb157ae4725b3bcfafe9bef1bb23a63a27eb3351b33d6644e2d04
data/README.md CHANGED
@@ -180,6 +180,19 @@ after_fork do
180
180
  end
181
181
  ```
182
182
 
183
+ ### Start Watchdog
184
+ When using `ProcessSettings` you can start a watchdog thread using `start_watchdog_thread` on a particular file path. The watchdog will poll once a minute to double-check if any changes have been missed due to a bug in the `listen` gem or the supporting OS drivers like `inotify`.
185
+ You may not start the watchdog thread it has already been started.
186
+ ```ruby
187
+ ProcessSettings.instance.start_watchdog_thread(file_path)
188
+ ```
189
+
190
+ ### Stop Watchdog
191
+ When using `ProcessSettings` you can stop a watchdog thread using `stop_watchdog_thread`. Once stopped you may start a new watchdog thread.
192
+ ```ruby
193
+ ProcessSettings.instance.stop_watchdog_thread
194
+ ```
195
+
183
196
  ### Testing
184
197
  For testing, it is often necessary to set a specific override hash for the process_settings values to use in
185
198
  that use case. The `ProcessSettings::Testing::RSpec::Helpers` and `ProcessSettings::Testing::Minitest::Helpers` modules are provided for this purpose.
@@ -9,7 +9,6 @@ require 'process_settings/abstract_monitor'
9
9
  require 'process_settings/targeted_settings'
10
10
  require 'process_settings/hash_path'
11
11
  require 'process_settings/helpers/watchdog'
12
- require 'exception_handling'
13
12
 
14
13
  module ProcessSettings
15
14
  class FileMonitor < AbstractMonitor
@@ -26,29 +25,22 @@ module ProcessSettings
26
25
  start_internal(enable_listen_thread?(environment))
27
26
  end
28
27
 
29
- def start_watchdog_thread(file_path = :missing)
30
- if file_path == :missing
31
- ActiveSupport::Deprecation.warn("ProcessEnvSetup.start_watchdog_thread with no arguments is deprecated")
32
- file_path = ProcessSettings::Monitor.file_path
33
- end
34
-
28
+ def start_watchdog_thread(file_path)
35
29
  @watchdog_thread and raise ArgumentError, "watchdog thread already running!"
36
30
  @watchdog_thread = Thread.new do
37
- watchdog = ProcessSettings::Watchdog.new(file_path)
31
+ watchdog = Watchdog.new(file_path)
38
32
  loop do
39
- ExceptionHandling.ensure_safe("ProcessSettings::Watchdog thread") do
40
- sleep(1.minute)
41
- watchdog.check
42
- end
33
+ sleep(1.minute)
34
+ watchdog.check
35
+ rescue => ex
36
+ logger.error("ProcessSettings::Watchdog thread: #{ex.class.name}: #{ex.message}")
43
37
  end
44
38
  end
45
39
  end
46
40
 
47
41
  def stop_watchdog_thread
48
- if @watchdog_thread
49
- Thread.kill(@watchdog_thread)
50
- @watchdog_thread = nil
51
- end
42
+ @watchdog_thread&.kill
43
+ @watchdog_thread = nil
52
44
  end
53
45
 
54
46
  def start
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.18.0.pre.1'
4
+ VERSION = '0.18.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0.pre.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ">"
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
- version: 1.3.1
128
+ version: '0'
129
129
  requirements: []
130
130
  rubygems_version: 3.0.3
131
131
  signing_key: