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 +4 -4
- data/README.md +13 -0
- data/lib/process_settings/file_monitor.rb +8 -16
- data/lib/process_settings/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aab773e1074ed3b357a5938e9366b56e69bdc6e36ace59835fdea8bbbe49516d
|
4
|
+
data.tar.gz: 3fe8bb70b1e59498420c878abb86cf2e1b0289694e4ed941a0a11b1a6abc5bce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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 =
|
31
|
+
watchdog = Watchdog.new(file_path)
|
38
32
|
loop do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
49
|
-
|
50
|
-
@watchdog_thread = nil
|
51
|
-
end
|
42
|
+
@watchdog_thread&.kill
|
43
|
+
@watchdog_thread = nil
|
52
44
|
end
|
53
45
|
|
54
46
|
def start
|
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
|
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:
|
128
|
+
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubygems_version: 3.0.3
|
131
131
|
signing_key:
|