Class: Specwrk::Web::Endpoints::Base
- Inherits:
-
Object
- Object
- Specwrk::Web::Endpoints::Base
- Defined in:
- lib/specwrk/web/endpoints/base.rb
Constant Summary collapse
- MUTEX =
Mutex.new
Instance Attribute Summary collapse
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
Instance Method Summary collapse
-
#initialize(request) ⇒ Base
constructor
A new instance of Base.
- #response ⇒ Object
- #with_response ⇒ Object
Constructor Details
#initialize(request) ⇒ Base
Returns a new instance of Base.
15 16 17 |
# File 'lib/specwrk/web/endpoints/base.rb', line 15 def initialize(request) @request = request end |
Instance Attribute Details
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
13 14 15 |
# File 'lib/specwrk/web/endpoints/base.rb', line 13 def started_at @started_at end |
Instance Method Details
#response ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/specwrk/web/endpoints/base.rb', line 19 def response return with_response unless run_id # No run_id, no datastore usage in the endpoint payload # parse the payload before any locking before_lock worker.first_seen_at ||= Time.now worker.last_seen_at = Time.now final_response = with_lock do started_at = [:started_at] ||= Time.now.iso8601 @started_at = Time.parse(started_at) with_response end after_lock final_response[1]["x-specwrk-status"] = worker_status.to_s final_response end |
#with_response ⇒ Object
43 44 45 |
# File 'lib/specwrk/web/endpoints/base.rb', line 43 def with_response not_found end |