snail_trail 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6bb23d00a867f1171eebe3f2666175aea84ae7e1b96ae8fec1bb9f6612520d9
4
- data.tar.gz: a38d58940070c970bef296118183d94413301631f9149fa63fbd318f8be86bf8
3
+ metadata.gz: 794fb24551639b3a92404d8b39aec5ff2632f740cff1449488ac29423f1a581b
4
+ data.tar.gz: c423186f0a787dcea5711e002770930363daf4b8688c7ce97b110913643d2519
5
5
  SHA512:
6
- metadata.gz: 89d48ae77066c7d885b61f2b2998f8791664e900b7b08957635e765754c608c23ab26ed0bc7592592230b0f428b613b7d571c58c91eaff1b4d28d4d967fe2065
7
- data.tar.gz: 311f8a01a376020a0cd4759061770b853db411c600ef1baf4ad2a703143e42f89d048d41d6f8dc6b02a30aae5fef22e6ef41a16eea2e0a8ce54d1e19cc34d33a
6
+ metadata.gz: 2a95e62809a51e755cbe6fe855819000bc22c30def0363985fb8986ea74045f8f36b739051174f581f72545e8237198f6ff6be188468b2e08cff5de099047968
7
+ data.tar.gz: c68e72359f86881803278587d4c74bdaa706211c6fbbcc1fc4b6cc6795c49364b6d674c5c1e6252e4ad1e44b6b2e7d2b8871c7f7b2bc8fdf5fd72aa54571fef5
data/CHANGELOG.adoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.1.1
2
+
3
+ * ``performance_mode!`` wasn't saving transaction IDs because it triggers once the transaction is closed
4
+
1
5
  == 1.1.0
2
6
 
3
7
  * Add ``performance_mode!``
@@ -127,9 +127,9 @@ module SnailTrail
127
127
  # Reset the transaction id when the transaction is closed.
128
128
  def setup_transaction_callbacks
129
129
  @model_class.after_commit do |r|
130
- ::SnailTrail.request.clear_transaction_id
130
+ r.snail_trail.record_performance_data(true)
131
131
 
132
- r.snail_trail.record_performance_data
132
+ ::SnailTrail.request.clear_transaction_id
133
133
 
134
134
  ::SnailTrail.request.clear_performance_mode_data
135
135
  end
@@ -154,14 +154,14 @@ module SnailTrail
154
154
  #
155
155
  # @return [void]
156
156
  #
157
- def record_performance_data
157
+ def record_performance_data(force = false)
158
158
  return unless ::SnailTrail.request.performance_mode?
159
159
 
160
160
  all_data = ::SnailTrail.request.performance_mode_data
161
161
 
162
162
  first_data = all_data.shift
163
163
  version = @record.class.snail_trail.version_class.create(first_data)
164
- update_transaction_id(version)
164
+ update_transaction_id(version, force)
165
165
 
166
166
  all_data.each_slice(1_000) do |datas|
167
167
  timestamp = Time.now.utc.strftime("%Y-%m-%d %H:%M:%S")
@@ -267,9 +267,9 @@ module SnailTrail
267
267
  data[:transaction_id] = ::SnailTrail.request.transaction_id
268
268
  end
269
269
 
270
- def update_transaction_id(version)
270
+ def update_transaction_id(version, force = false)
271
271
  return unless @record.class.snail_trail.version_class.column_names.include?("transaction_id")
272
- if ::SnailTrail.transaction? && ::SnailTrail.request.transaction_id.nil?
272
+ if (::SnailTrail.transaction? || force) && ::SnailTrail.request.transaction_id.nil?
273
273
  ::SnailTrail.request.transaction_id = version.id
274
274
  version.transaction_id = version.id
275
275
  version.save
@@ -9,7 +9,7 @@ module SnailTrail
9
9
  module VERSION
10
10
  MAJOR = 1
11
11
  MINOR = 1
12
- TINY = 0
12
+ TINY = 1
13
13
 
14
14
  # Set PRE to nil unless it's a pre-release (beta, rc, etc.)
15
15
  PRE = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snail_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-12 00:00:00.000000000 Z
11
+ date: 2025-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord