config_skeleton 1.1.0 → 2.0.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: 0b419f026421b513b20f2950609f9b45339d86433b88e8372bd94746f6a72091
4
- data.tar.gz: 7e0a5ac1b0dfe9ad7ee989aeb9d0051b06d179190328460ba09c273312b36b7d
3
+ metadata.gz: 99dfaca5fbeaf8f2bd6c5fd921e854294cd1f01be8e27613ad58e7581e7b1bf5
4
+ data.tar.gz: 552d8592225a20807716bd74ab8eaf1866b25a1d8b7acec75eedb98d22cb95cf
5
5
  SHA512:
6
- metadata.gz: c36398b332b1bfa53a66d11a2c083af4a0f794e53fba518278fcef7ef41dfc63d51b4b010f508eeb898bf99c10ff55a2f813251bdfefe122a70e3254b87da46a
7
- data.tar.gz: 53acc41e5da3aea61cda288cfe90f122e8d8871eea594d5e4b0857d127c01ba20a542df7087884c34e0e75589e968820d53b41db62c3f85f91d49eea9dbf88a2
6
+ metadata.gz: 4748a0d790e28a991555bf8647d79c71f827ba41d7d9a48156d9783a1e8e7ddefbe1acb4417c92667cb128e9c542b1e2aaa000d4adafa68aaf0a058d1e620d2d
7
+ data.tar.gz: 8cd5d2474c55a59255d53c1ed87bfb5c1a5bebe8df32117f9c49c4486ba1647a263c397606a0afb5fd67e22edaffd2df6c436ee8fb866b4bb066ff3d395960f9
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = "config_skeleton"
3
5
 
4
- s.version = "1.1.0"
6
+ s.version = "2.0.0"
5
7
 
6
8
  s.platform = Gem::Platform::RUBY
7
9
 
@@ -17,13 +19,14 @@ Gem::Specification.new do |s|
17
19
 
18
20
  s.add_runtime_dependency 'diffy', '~> 3.0'
19
21
  s.add_runtime_dependency 'rb-inotify', '~> 0.9'
20
- s.add_runtime_dependency 'service_skeleton', "~> 1.0"
22
+ s.add_runtime_dependency 'service_skeleton', "~> 2.0"
21
23
 
22
24
  s.add_development_dependency 'bundler'
23
25
  s.add_development_dependency 'github-release'
24
26
  s.add_development_dependency 'rake', "~> 12.0"
25
27
  s.add_development_dependency 'redcarpet'
26
28
  s.add_development_dependency 'rubocop'
29
+ s.add_development_dependency 'rubocop-discourse'
27
30
  s.add_development_dependency 'yard'
28
31
  s.add_development_dependency 'rspec'
29
32
  s.add_development_dependency 'pry'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'diffy'
2
4
  require 'fileutils'
3
5
  require 'frankenstein'
@@ -240,16 +242,11 @@ class ConfigSkeleton
240
242
  logger.debug(logloc) { "notifier fd is #{notifier.to_io.inspect}" }
241
243
 
242
244
  loop do
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
245
+ if ios = IO.select(
246
+ [notifier.to_io, @terminate_r, @trigger_regen_r],
247
+ [], [],
248
+ sleep_duration.tap { |d| logger.debug(logloc) { "Sleeping for #{d} seconds" } }
249
+ )
253
250
  if ios.first.include?(notifier.to_io)
254
251
  logger.debug(logloc) { "inotify triggered" }
255
252
  notifier.process
@@ -449,21 +446,6 @@ class ConfigSkeleton
449
446
  60
450
447
  end
451
448
 
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
-
467
449
  # The instance of INotify::Notifier that is holding our file watches.
468
450
  #
469
451
  # @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.1.0
4
+ version: 2.0.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-11 00:00:00.000000000 Z
12
+ date: 2021-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.0'
48
+ version: '2.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '1.0'
55
+ version: '2.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +123,20 @@ dependencies:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop-discourse
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
126
140
  - !ruby/object:Gem::Dependency
127
141
  name: yard
128
142
  requirement: !ruby/object:Gem::Requirement