sensu 0.28.3 → 0.28.4

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
  SHA1:
3
- metadata.gz: 9121ba275faec01ad227bfe360ecf35f98bb8136
4
- data.tar.gz: a9bd2e508a8f271456775a4061ed9ba4e016880c
3
+ metadata.gz: b6072e3c9acc34e26707916ecb39a15412ac9d6b
4
+ data.tar.gz: 4684fa7e0c3b7184e3f6e86ff261ab40cee32eb9
5
5
  SHA512:
6
- metadata.gz: f8493131b507781309e4c769d2e3f9273a1bbe97fc6d5bb82d140b44cd4058ea9edf182ec57c955a0156d3a99cc42ddebfc0089c7e2b20813d9505d062b855f8
7
- data.tar.gz: a2aa66bc4afe3abcbbe5f378712bd6854784086d5b79865020f85d58a7a652ef4a1c6fe993fe15011eba43e03d8b8af71d90276311aa1043f810b21bfdd1a306
6
+ metadata.gz: aecfd752576017e158a8f9e56759ebccdcbf3f11244b361b1dc26e495a7bfea25ceeccdf35f347f7c4472ff50a015c0f62cfcb14a5a532c58de888ac7ac5cde9
7
+ data.tar.gz: 0759e0044dc2f52816cae0ccd29a19ddf52db86a32b4706ae9dfbc6523f2b6b793a7f5be9f7b8fedb91e5d87e38cbf56076614f109a8126f82ac5804d0fb47f2
@@ -1,3 +1,11 @@
1
+ ## 0.28.4 - 2017-03-10
2
+
3
+ ### Fixes
4
+
5
+ In the interest of addressing a regression causing duplicate check
6
+ execution requests, code added in 0.28.0 to account for task scheduling
7
+ drift has been removed.
8
+
1
9
  ## 0.28.3 - 2017-03-09
2
10
 
3
11
  ### Fixes
@@ -138,7 +138,7 @@ module Sensu
138
138
  end
139
139
  end
140
140
  else
141
- Timer.new(1) do
141
+ EM::Timer.new(1) do
142
142
  delete_client.call(attempts)
143
143
  end
144
144
  end
@@ -69,7 +69,7 @@ module Sensu
69
69
  def setup_keepalives
70
70
  @logger.debug("scheduling keepalives")
71
71
  publish_keepalive
72
- @timers[:run] << PeriodicTimer.new(20) do
72
+ @timers[:run] << EM::PeriodicTimer.new(20) do
73
73
  publish_keepalive
74
74
  end
75
75
  end
@@ -307,7 +307,7 @@ module Sensu
307
307
  # @param check [Hash] definition.
308
308
  def schedule_check_cron_execution(check)
309
309
  cron_time = determine_check_cron_time(check)
310
- @timers[:run] << Timer.new(cron_time) do |timer|
310
+ @timers[:run] << EM::Timer.new(cron_time) do |timer|
311
311
  create_check_execution_proc(check).call
312
312
  @timers[:run].delete(timer)
313
313
  schedule_check_cron_execution(check)
@@ -336,10 +336,10 @@ module Sensu
336
336
  def schedule_check_interval_executions(check)
337
337
  execution_splay = testing? ? 0 : calculate_check_execution_splay(check)
338
338
  interval = testing? ? 0.5 : check[:interval]
339
- @timers[:run] << Timer.new(execution_splay) do
339
+ @timers[:run] << EM::Timer.new(execution_splay) do
340
340
  execute_check = create_check_execution_proc(check)
341
341
  execute_check.call
342
- @timers[:run] << PeriodicTimer.new(interval, &execute_check)
342
+ @timers[:run] << EM::PeriodicTimer.new(interval, &execute_check)
343
343
  end
344
344
  end
345
345
 
@@ -106,7 +106,7 @@ module Sensu
106
106
  # Reset (or start) the connection watchdog.
107
107
  def reset_watchdog
108
108
  cancel_watchdog
109
- @watchdog = Timer.new(WATCHDOG_DELAY) do
109
+ @watchdog = EM::Timer.new(WATCHDOG_DELAY) do
110
110
  @mode = MODE_REJECT
111
111
  @logger.warn("discarding data buffer for sender and closing connection", {
112
112
  :data => @data_buffer,
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "0.28.3".freeze
4
+ VERSION = "0.28.4".freeze
5
5
 
6
6
  # Sensu check severities.
7
7
  SEVERITIES = %w[ok warning critical unknown].freeze
@@ -18,7 +18,6 @@ if RUBY_PLATFORM =~ /aix/ || RUBY_PLATFORM =~ /solaris/
18
18
  require "em/pure_ruby"
19
19
  end
20
20
 
21
- require "sensu/timers"
22
21
  require "sensu/json"
23
22
  require "sensu/logger"
24
23
  require "sensu/settings"
@@ -228,7 +227,7 @@ module Sensu
228
227
  @signals << signal
229
228
  end
230
229
  end
231
- PeriodicTimer.new(1) do
230
+ EM::PeriodicTimer.new(1) do
232
231
  signal = @signals.shift
233
232
  if STOP_SIGNALS.include?(signal)
234
233
  @logger.warn("received signal", :signal => signal)
@@ -845,7 +845,7 @@ module Sensu
845
845
  # @param check [Hash] definition.
846
846
  def schedule_check_cron_request(check)
847
847
  cron_time = determine_check_cron_time(check)
848
- @timers[:leader] << Timer.new(cron_time) do |timer|
848
+ @timers[:leader] << EM::Timer.new(cron_time) do |timer|
849
849
  create_check_request_proc(check).call
850
850
  @timers[:leader].delete(timer)
851
851
  schedule_check_cron_request(check)
@@ -874,10 +874,10 @@ module Sensu
874
874
  def schedule_check_interval_requests(check)
875
875
  request_splay = testing? ? 0 : calculate_check_request_splay(check)
876
876
  interval = testing? ? 0.5 : check[:interval]
877
- @timers[:leader] << Timer.new(request_splay) do
877
+ @timers[:leader] << EM::Timer.new(request_splay) do
878
878
  create_check_request = create_check_request_proc(check)
879
879
  create_check_request.call
880
- @timers[:leader] << PeriodicTimer.new(interval, &create_check_request)
880
+ @timers[:leader] << EM::PeriodicTimer.new(interval, &create_check_request)
881
881
  end
882
882
  end
883
883
 
@@ -1037,7 +1037,7 @@ module Sensu
1037
1037
  # stored in the timers hash under `:leader`.
1038
1038
  def setup_client_monitor
1039
1039
  @logger.debug("monitoring client keepalives")
1040
- @timers[:leader] << PeriodicTimer.new(30) do
1040
+ @timers[:leader] << EM::PeriodicTimer.new(30) do
1041
1041
  determine_stale_clients
1042
1042
  end
1043
1043
  end
@@ -1083,7 +1083,7 @@ module Sensu
1083
1083
  # is stored in the timers hash under `:leader`.
1084
1084
  def setup_check_result_monitor(interval = 30)
1085
1085
  @logger.debug("monitoring check results")
1086
- @timers[:leader] << PeriodicTimer.new(interval) do
1086
+ @timers[:leader] << EM::PeriodicTimer.new(interval) do
1087
1087
  determine_stale_check_results(interval)
1088
1088
  end
1089
1089
  end
@@ -1214,10 +1214,10 @@ module Sensu
1214
1214
  # every 10 seconds. The timers are stored in the timers hash
1215
1215
  # under `:run`.
1216
1216
  def setup_leader_monitor
1217
- @timers[:run] << Timer.new(2) do
1217
+ @timers[:run] << EM::Timer.new(2) do
1218
1218
  request_leader_election
1219
1219
  end
1220
- @timers[:run] << PeriodicTimer.new(10) do
1220
+ @timers[:run] << EM::PeriodicTimer.new(10) do
1221
1221
  if @is_leader
1222
1222
  update_leader_lock
1223
1223
  else
@@ -1267,7 +1267,7 @@ module Sensu
1267
1267
  # timer is stored in the timers hash under `:run`.
1268
1268
  def setup_server_registry_updater
1269
1269
  update_server_registry
1270
- @timers[:run] << PeriodicTimer.new(10) do
1270
+ @timers[:run] << EM::PeriodicTimer.new(10) do
1271
1271
  update_server_registry
1272
1272
  end
1273
1273
  end
@@ -18,7 +18,7 @@ module Sensu
18
18
  #
19
19
  # @param timeout [Numeric] in seconds.
20
20
  def set_timeout(timeout)
21
- @timeout_timer = Timer.new(timeout) do
21
+ @timeout_timer = EM::Timer.new(timeout) do
22
22
  @timed_out = true
23
23
  close_connection
24
24
  end
@@ -23,7 +23,7 @@ module Sensu
23
23
  # @param wait [Numeric] time to delay block calls.
24
24
  # @param block [Proc] to call that needs to return true.
25
25
  def retry_until_true(wait=0.5, &block)
26
- Timer.new(wait) do
26
+ EM::Timer.new(wait) do
27
27
  unless block.call
28
28
  retry_until_true(wait, &block)
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.3
4
+ version: 0.28.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-03-09 00:00:00.000000000 Z
12
+ date: 2017-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -275,7 +275,6 @@ files:
275
275
  - lib/sensu/server/mutate.rb
276
276
  - lib/sensu/server/process.rb
277
277
  - lib/sensu/server/socket.rb
278
- - lib/sensu/timers.rb
279
278
  - lib/sensu/utilities.rb
280
279
  - sensu.gemspec
281
280
  homepage: http://sensuapp.org
@@ -1,26 +0,0 @@
1
- require "eventmachine"
2
-
3
- module Sensu
4
- class Timer < EventMachine::Timer; end
5
-
6
- # This fix comes from http://soohwan.blogspot.ca/2011/02/fix-eventmachineperiodictimer.html
7
- class PeriodicTimer < EventMachine::PeriodicTimer
8
- alias :original_initialize :initialize
9
- alias :original_schedule :schedule
10
-
11
- # Record initial start time and the fixed interval, used for
12
- # compensating for timer drift when scheduling the next call.
13
- def initialize(interval, callback=nil, &block)
14
- @start = Time.now
15
- @fixed_interval = interval
16
- original_initialize(interval, callback, &block)
17
- end
18
-
19
- # Calculate the timer drift and compensate for it.
20
- def schedule
21
- compensation = (Time.now - @start) % @fixed_interval
22
- @interval = @fixed_interval - compensation
23
- original_schedule
24
- end
25
- end
26
- end