Module: ScoutAgent::Tracked
- Included in:
- Agent, Assignment, Lifeline
- Defined in:
- lib/scout_agent/tracked.rb
Overview
A mix-in for adding status tracking to various objects. Methods are provided to set your current status and clear your status.
Instance Method Summary collapse
-
#clear_status(*args) ⇒ Object
:call-seq: clear_status(name = IDCard.me && IDCard.me.process_name).
-
#force_status_database_reload ⇒ Object
Call this to clear the cached database handle after a
fork()
. -
#status(*args) ⇒ Object
:call-seq: status(status, name = IDCard.me && IDCard.me.process_name).
-
#status_database(log = nil) ⇒ Object
Returns the status database this object this object can use to update its status.
-
#status_log ⇒ Object
Returns the
log()
for this object, if supported and set, or a bit bucket log object.
Instance Method Details
#clear_status(*args) ⇒ Object
56 57 58 |
# File 'lib/scout_agent/tracked.rb', line 56 def clear_status(*args) status_database.clear_status(*args) if status_database end |
#force_status_database_reload ⇒ Object
Call this to clear the cached database handle after a fork()
.
32 33 34 |
# File 'lib/scout_agent/tracked.rb', line 32 def force_status_database_reload @status_database = nil end |
#status(*args) ⇒ Object
43 44 45 |
# File 'lib/scout_agent/tracked.rb', line 43 def status(*args) status_database.update_status(*args) if status_database end |
#status_database(log = nil) ⇒ Object
Returns the status database this object this object can use to update its status.
This value is cached after the first call to speed up future interactions with the database. You’ll need to reset the cached value with a call to force_status_database_reload() after doing something that would invalidate a SQLite database handle like fork()
.
27 28 29 |
# File 'lib/scout_agent/tracked.rb', line 27 def status_database(log = nil) @status_database ||= Database.load(:statuses, status_log) end |