config_skeleton 1.0.0 → 1.1.0
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 +4 -4
- data/config_skeleton.gemspec +1 -1
- data/lib/config_skeleton.rb +25 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b419f026421b513b20f2950609f9b45339d86433b88e8372bd94746f6a72091
|
4
|
+
data.tar.gz: 7e0a5ac1b0dfe9ad7ee989aeb9d0051b06d179190328460ba09c273312b36b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c36398b332b1bfa53a66d11a2c083af4a0f794e53fba518278fcef7ef41dfc63d51b4b010f508eeb898bf99c10ff55a2f813251bdfefe122a70e3254b87da46a
|
7
|
+
data.tar.gz: 53acc41e5da3aea61cda288cfe90f122e8d8871eea594d5e4b0857d127c01ba20a542df7087884c34e0e75589e968820d53b41db62c3f85f91d49eea9dbf88a2
|
data/config_skeleton.gemspec
CHANGED
data/lib/config_skeleton.rb
CHANGED
@@ -240,11 +240,16 @@ class ConfigSkeleton
|
|
240
240
|
logger.debug(logloc) { "notifier fd is #{notifier.to_io.inspect}" }
|
241
241
|
|
242
242
|
loop do
|
243
|
-
if
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
243
|
+
if cooldown_duration > 0
|
244
|
+
logger.debug(logloc) { "Sleeping for #{cooldown_duration} seconds (cooldown)" }
|
245
|
+
IO.select([@terminate_r], [], [], cooldown_duration)
|
246
|
+
end
|
247
|
+
|
248
|
+
timeout = sleep_duration - cooldown_duration
|
249
|
+
logger.debug(logloc) { "Sleeping for #{timeout} seconds unless interrupted" }
|
250
|
+
ios = IO.select([notifier.to_io, @terminate_r, @trigger_regen_r], [], [], timeout)
|
251
|
+
|
252
|
+
if ios
|
248
253
|
if ios.first.include?(notifier.to_io)
|
249
254
|
logger.debug(logloc) { "inotify triggered" }
|
250
255
|
notifier.process
|
@@ -444,6 +449,21 @@ class ConfigSkeleton
|
|
444
449
|
60
|
445
450
|
end
|
446
451
|
|
452
|
+
# How long to ignore signals/notifications after a config regeneration
|
453
|
+
#
|
454
|
+
# Hammering a downstream service with reload requests is often a bad idea.
|
455
|
+
# This method exists to allow subclasses to define a 'cooldown' duration.
|
456
|
+
# After each config regeneration, the config generator will sleep for this
|
457
|
+
# duration, regardless of any CONT signals or inotify events. Those events
|
458
|
+
# will be queued up, and processed at the end of the cooldown.
|
459
|
+
#
|
460
|
+
# @return [Integer] the number of seconds to 'cooldown' for. This *must* be
|
461
|
+
# greater than zero, and less than sleep_duration
|
462
|
+
#
|
463
|
+
def cooldown_duration
|
464
|
+
5
|
465
|
+
end
|
466
|
+
|
447
467
|
# The instance of INotify::Notifier that is holding our file watches.
|
448
468
|
#
|
449
469
|
# @return [INotify::Notifier]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_skeleton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: diffy
|