Class: MailRoom::HealthCheck
- Inherits:
-
Object
- Object
- MailRoom::HealthCheck
- Defined in:
- lib/mail_room/health_check.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#running ⇒ Object
readonly
Returns the value of attribute running.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ HealthCheck
constructor
A new instance of HealthCheck.
- #quit ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ HealthCheck
Returns a new instance of HealthCheck.
7 8 9 10 11 12 |
# File 'lib/mail_room/health_check.rb', line 7 def initialize(attributes = {}) @address = attributes[:address] @port = attributes[:port] validate! end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
5 6 7 |
# File 'lib/mail_room/health_check.rb', line 5 def address @address end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/mail_room/health_check.rb', line 5 def port @port end |
#running ⇒ Object (readonly)
Returns the value of attribute running.
5 6 7 |
# File 'lib/mail_room/health_check.rb', line 5 def running @running end |
Instance Method Details
#quit ⇒ Object
25 26 27 28 29 |
# File 'lib/mail_room/health_check.rb', line 25 def quit @running = false @server&.shutdown @thread&.join(60) end |
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mail_room/health_check.rb', line 14 def run @server = create_server @thread = Thread.new do @server.start end @thread.abort_on_exception = true @running = true end |