lib/arborist/monitor/socket.rb in arborist-0.2.0 vs lib/arborist/monitor/socket.rb in arborist-0.3.0

- old
+ new

@@ -22,10 +22,15 @@ # seconds. setting :default_timeout, default: 2.0 do |val| Float( val ) end + ## + # The number of socket connections to attempt simultaneously. + setting :batch_size, default: 150 do |val| + Integer( val ) + end end # Arborist TCP socket monitor logic class TCP @@ -53,12 +58,15 @@ ### Create a new TCP monitor with the specified +options+. Valid options are: ### ### +:timeout+ ### Set the number of seconds to wait for a connection for each node. - def initialize( timeout: Arborist::Monitor::Socket.default_timeout ) + ### +:batch_size+ + ### The number of UDP connection attempts to perform simultaneously. + def initialize( timeout: Arborist::Monitor::Socket.default_timeout, batch_size: Arborist::Monitor::Socket.batch_size ) self.timeout = timeout + self.batch_size = batch_size end ###### public @@ -125,16 +133,10 @@ extend Loggability include Arborist::Monitor::ConnectionBatching log_to :arborist - - # Defaults for instances of this monitor - DEFAULT_OPTIONS = { - timeout: 0.001 - } - # Always request the node addresses and port. USED_PROPERTIES = [ :addresses, :port ].freeze ### Instantiate a monitor check and run it for the specified +nodes+. @@ -151,11 +153,14 @@ ### Create a new UDP monitor with the specified +options+. Valid options are: ### ### +:timeout+ ### Set the number of seconds to wait for a connection for each node. - def initialize( timeout: Arborist::Monitor::Socket.default_timeout ) + ### +:batch_size+ + ### The number of UDP connection attempts to perform simultaneously. + def initialize( timeout: Arborist::Monitor::Socket.default_timeout, batch_size: Arborist::Monitor::Socket.batch_size ) self.timeout = timeout + self.batch_size = batch_size end ###### public