diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-07-05 14:00:13 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-07-05 14:00:13 +0100 |
commit | f4c1559078f0408375551964de73a892b8a6a9be (patch) | |
tree | 2f1dd60470899ac096b3a829d43937a3526b784e /lib/mauve | |
parent | 4bc9c1005cdbb14d5d310ba7674e068b2098e19c (diff) |
Updated configuration for heartbeat to replace poll_every.
Removed poll_every from other classes.
Updated tests to reflect this.
Diffstat (limited to 'lib/mauve')
-rw-r--r-- | lib/mauve/configuration_builders/server.rb | 10 | ||||
-rw-r--r-- | lib/mauve/heartbeat.rb | 17 | ||||
-rw-r--r-- | lib/mauve/udp_server.rb | 2 |
3 files changed, 14 insertions, 15 deletions
diff --git a/lib/mauve/configuration_builders/server.rb b/lib/mauve/configuration_builders/server.rb index 734fb3b..ea12724 100644 --- a/lib/mauve/configuration_builders/server.rb +++ b/lib/mauve/configuration_builders/server.rb @@ -36,8 +36,6 @@ module Mauve is_attribute "port" # This is the IP address the server listens on. IPv6 is OK! e.g. [::] for all addresses is_attribute "ip" - # This is the sleep interval for the UDP server. - is_attribute "poll_every" # Sets up a Mauve::UDPServer singleton as the result # @@ -51,8 +49,6 @@ module Mauve # This is the thread that pulls packets from the queue for processing. # class Processor < ObjectBuilder - # This is the interval between polls of the packet queue. - is_attribute "poll_every" # This is the timeout for the transmission cache, which allows duplicate packets to be discarded. is_attribute "transmission_cache_expire_time" @@ -65,12 +61,6 @@ module Mauve end class Notifier < ObjectBuilder - # - # This is the interval at which the notification queue is polled for new - # notifications to be sent. This will not have any rate-limiting effect. - # - is_attribute "poll_every" - # Sets up a Mauve::Notifier singleton as the result # # @return [Mauve::Notifier] diff --git a/lib/mauve/heartbeat.rb b/lib/mauve/heartbeat.rb index 1fe2fab..11f4d5b 100644 --- a/lib/mauve/heartbeat.rb +++ b/lib/mauve/heartbeat.rb @@ -15,7 +15,7 @@ module Mauve # # Allow access to some basics. # - attr_reader :raise_after, :destination, :summary, :detail + attr_reader :raise_after, :destination, :summary, :detail, :send_every # # This sets up the Heartbeat singleton @@ -27,7 +27,7 @@ module Mauve @summary = "Mauve alert server heartbeat failed" @detail = "The Mauve server at #{Server.instance.hostname} has failed to send a heartbeat." @raise_after = 310 - @poll_every = 60 + @send_every = 60 end # @@ -38,8 +38,17 @@ module Mauve raise ArgumentError "raise_after must be an integer" unless i.is_a?(Integer) @raise_after = i end + + # + # This is the time period after which an alert is raised by the remote Mauve instance. + # @param [Integer] i Seconds + # @return [Integer] Seconds + def send_every=(i) + raise ArgumentError "send_every must be an integer" unless i.is_a?(Integer) + @send_every = i + end - alias send_every= poll_every= + alias poll_every= send_every= # Sets the summary of the heartbeat # @@ -97,6 +106,8 @@ module Mauve Mauve::Sender.new(self.destination).send(update) logger.debug "Sent to #{self.destination}" + + sleep @send_every end end diff --git a/lib/mauve/udp_server.rb b/lib/mauve/udp_server.rb index e3362e8..9dafdd0 100644 --- a/lib/mauve/udp_server.rb +++ b/lib/mauve/udp_server.rb @@ -22,7 +22,6 @@ module Mauve # Defaults: # * listening IP: 127.0.0.1 # * listening port: 32741 - # * polls every: 0 seconds # def initialize # @@ -30,7 +29,6 @@ module Mauve # self.ip = "127.0.0.1" self.port = 32741 - self.poll_every = 0 @socket = nil super |