alacrity-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4a31f3e6df15a1a21699624e93401efa2558982
4
- data.tar.gz: accd16378db208150a6877e887e65809d4b5e1fd
3
+ metadata.gz: 43abf54365fdbf4532f726fa977e2da4f822fd23
4
+ data.tar.gz: c0cacaa8b543d335e6d4c18d30c65223a106dfd4
5
5
  SHA512:
6
- metadata.gz: c26325730dee3b9f34bb75501472377cf2807aca50be22f6e8b6af0e6a3ae08b8cdc8f54d634125492d0b8c175a6e8c9679ea34bf0281dde7d1fba31417b6f6c
7
- data.tar.gz: 66b0db61e130bbc1b9467fa2d77b2fe39e52db07fa3a86ad7ce87af8903f70439d09fef971f8cd17b8b7d161aaf2f669bc1ca0a8c0c2783236c6fbf8a9b094a7
6
+ metadata.gz: fc6b890d8bb41b5aeb7f4aa86ea3eedd6f884826c41caf76829c9ff83cb688a53ea8b932cbfc5979a5d38bfbeda8db1748a3ba19254ee3a268472c6931dab6c7
7
+ data.tar.gz: 0ee1e55ef7fd76cc84eea0511acc91f3889d38cfe45c658ace48928bdc10040e22a78121b59ce46546f33e24dd4636556d988f474792f50fac8321771e4fb8d6
@@ -16,6 +16,7 @@ module AlacrityRails
16
16
  def self.close_transaction!(response)
17
17
  if transaction
18
18
  transaction.status = response.first
19
+ transaction.finalize!
19
20
  transmission_queue.push(transaction)
20
21
  end
21
22
  ensure
@@ -1,7 +1,7 @@
1
1
  module AlacrityRails::Transaction
2
2
  class WebTransaction < Base
3
- attr_accessor :url, :middleware_started_at, :controller, :action, :format,
4
- :method, :status
3
+ attr_accessor :url, :middleware_started_at, :middleware_finished_at,
4
+ :controller, :action, :format, :method, :status
5
5
 
6
6
  def initialize(env={})
7
7
  self.middleware_started_at = absolute_time(DateTime.now)
@@ -26,14 +26,17 @@ module AlacrityRails::Transaction
26
26
  }
27
27
  end
28
28
 
29
+ def finalize!
30
+ self.middleware_finished_at = absolute_time(DateTime.now)
31
+ end
32
+
29
33
  def as_json(*args)
30
- middleware_finished_at = absolute_time(DateTime.now)
31
34
  {
32
35
  environment: AlacrityRails::ServerConfig.environment,
33
36
  url: url,
34
37
  controller: controller,
35
38
  action: action,
36
- middleware_elapsed: middleware_finished_at - middleware_started_at,
39
+ middleware_elapsed: (middleware_finished_at || absolute_time(DateTime.now)) - middleware_started_at,
37
40
  middleware_started_at: middleware_started_at,
38
41
  middleware_finished_at: middleware_finished_at,
39
42
  format: format,
@@ -1,3 +1,3 @@
1
1
  module AlacrityRails
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alacrity-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alacrity, LLC