isolator 1.1.0 → 1.1.2

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: 0c72b8d090e9f2d9f0aa40981298f62bb562d5a1064868f771c2e5cd8af029bc
4
- data.tar.gz: 7aef3385898b9db409b4251becfc85f3bb7004d411be4240d8126bb9d9c4d5b7
3
+ metadata.gz: a37693d4626a6bb72e14c00562274a1002c557aca0122182f2422be08e225ad8
4
+ data.tar.gz: ed49eb36314577217281389ea07d3dcb8c72c30373fd03f6b6609e2d43ea4d99
5
5
  SHA512:
6
- metadata.gz: eaeff564dc8bb7288b3249325144c60096e35066b994b8ebb7365d8ee949a5b44b47d276eedbcb8580c0d460fa5c46a9d1529e002c0904f04452e96bb02069fc
7
- data.tar.gz: 6d068fab30b04a15e58afddc1ee23a2a0492051b0d3b9d20784da421aced0d2e1aa548b3ea74b4d9e395c84ff275660baf8ab0fd6825f9f8e9b9c947220b7be3
6
+ metadata.gz: e3c11b5f2da9fa95dc4f167b757e5a0dee3466ead28cb458839b1651b8e6db0631f72b9d1bcc0de239f41adb27b3dbd99aab46cf2d3872bcd462c75aa61aa471
7
+ data.tar.gz: c9ea41ae4b214da35c3e5c8c53c75c5f8f3b74b620ff5e2f3d1dbfcbb52312f3620ba811829c7a46b82de87cb00420d74b55d1efc7b5a1cd47295ac4eca60afe
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.1.2 (2025-10-16)
6
+
7
+ - Fix `database_cleaner` support: require `base.rb` explicitly. ([@viralpraxis][])
8
+
9
+ - Fix checking for Rails versions between 8.0 and 8.1. ([@sunny][])
10
+
11
+ ## 1.1.1 (2025-03-12)
12
+
13
+ - Fix handling Rails 8 `enqueue_after_transaction_commit` logic. ([@palkan][])
14
+
5
15
  ## 1.1.0 (2024-08-12)
6
16
 
7
17
  - Add support for `ActiveJob::Base.enqueue_after_transaction_commit`. ([@joshuay03][])
data/README.md CHANGED
@@ -108,7 +108,7 @@ Isolator.configure do |config|
108
108
  config.ignorer = Isolator::Ignorer
109
109
 
110
110
  # Turn on/off raising exceptions for simultaneous transactions to different databases
111
- config.disallow_cross_database_transactions = false
111
+ config.disallow_per_thread_concurrent_transactions = false
112
112
  end
113
113
  ```
114
114
 
@@ -132,13 +132,13 @@ Isolator.after_isolate do
132
132
  end
133
133
 
134
134
  # This callback is called every time a new transaction is open (root or nested)
135
- Isolator.on_transaction_open do |event|
135
+ Isolator.on_transaction_begin do |event|
136
136
  puts "New transaction from #{event[:connection_id]}. " \
137
137
  "Current depth: #{event[:depth]}"
138
138
  end
139
139
 
140
140
  # This callback is called every time a transaction is completed
141
- Isolator.on_transaction_close do |event|
141
+ Isolator.on_transaction_end do |event|
142
142
  puts "Transaction completed from #{event[:connection_id]}. " \
143
143
  "Current depth: #{event[:depth]}"
144
144
  end
@@ -6,10 +6,9 @@ Isolator.isolate :active_job,
6
6
  exception_class: Isolator::BackgroundJobError,
7
7
  details_message: ->(obj) {
8
8
  "#{obj.class.name}" \
9
- "#{obj.arguments.any? ? " (#{obj.arguments.join(", ")})" : ""}"
9
+ "#{" (#{obj.arguments.join(", ")})" if obj.arguments.any?}"
10
10
  },
11
11
  ignore_on: ->(job) {
12
12
  config = job.class.try(:enqueue_after_transaction_commit)
13
- config == :always || (config == :default &&
14
- ActiveJob::Base.queue_adapter.try(:enqueue_after_transaction_commit?) == true)
13
+ config == true
15
14
  }
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "database_cleaner/active_record/base"
3
4
  require "database_cleaner/active_record/transaction"
4
5
  ::DatabaseCleaner::ActiveRecord::Transaction.prepend(
5
6
  Module.new do
@@ -3,7 +3,8 @@
3
3
  require_relative "active_support_subscriber"
4
4
 
5
5
  # We rely on this feature introduced in 7.1.0.beta1: https://github.com/rails/rails/pull/49192
6
- if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 1
6
+ if (ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 1) ||
7
+ ActiveRecord.version >= Gem::Version.new("7.1")
7
8
  require_relative "active_support_transaction_subscriber"
8
9
  Isolator::ActiveSupportTransactionSubscriber.subscribe!
9
10
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isolator
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.2"
5
5
  end
data/lib/isolator.rb CHANGED
@@ -20,7 +20,7 @@ module Isolator
20
20
  class ThreadStateProxy
21
21
  attr_reader :prefix
22
22
 
23
- def initilize(prefix = "isolator_")
23
+ def initialize(prefix = "isolator_")
24
24
  @prefix = prefix
25
25
  end
26
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-12 00:00:00.000000000 Z
11
+ date: 2025-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sniffer
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 5.10.0
89
+ version: '5.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 5.10.0
96
+ version: '5.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sidekiq
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -331,7 +331,7 @@ metadata:
331
331
  homepage_uri: http://github.com/palkan/isolator
332
332
  source_code_uri: http://github.com/palkan/isolator
333
333
  funding_uri: https://github.com/sponsors/palkan
334
- post_install_message:
334
+ post_install_message:
335
335
  rdoc_options: []
336
336
  require_paths:
337
337
  - lib
@@ -347,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
347
  version: '0'
348
348
  requirements: []
349
349
  rubygems_version: 3.4.19
350
- signing_key:
350
+ signing_key:
351
351
  specification_version: 4
352
352
  summary: Detect non-atomic interactions within DB transactions
353
353
  test_files: []