Class: ServerStatus::HostSet
- Inherits:
-
Object
- Object
- ServerStatus::HostSet
- Defined in:
- lib/server-status/host_set.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#hosts ⇒ Object
Returns the value of attribute hosts.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #fetch_statuses ⇒ Object
-
#initialize(config, options, hosts) ⇒ HostSet
constructor
A new instance of HostSet.
Constructor Details
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/server-status/host_set.rb', line 5 def config @config end |
#hosts ⇒ Object
Returns the value of attribute hosts.
5 6 7 |
# File 'lib/server-status/host_set.rb', line 5 def hosts @hosts end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/server-status/host_set.rb', line 5 def @options end |
Instance Method Details
#fetch_statuses ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/server-status/host_set.rb', line 14 def fetch_statuses = TTY::ProgressBar.new("Querying hosts [:bar]", total: @hosts.size, clear: true, hide_cursor: true) semaphore = Mutex.new completed_hosts = 0 threads = @hosts.map do |host| Thread.new do host.fetch_status(status_command) semaphore.synchronize { .advance } end end threads.each(&:join) end |