isolator 0.7.0 → 0.8.0

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: 00d85d8a62a5a34bd39ef9295e1e8ad9c13599fc17648bbda7a5012f9a89ddfa
4
- data.tar.gz: cf7a441154f63bc40258b4a78e57e3d3f46158b915167c1631d717530571dcd2
3
+ metadata.gz: 5c40700b0b2f7e5025ed7cbfb80580ac9ee1516a1295146bf0fa9db1de6e2a7f
4
+ data.tar.gz: 7d605d3790733c0b1bcd44e6188c30050900879042ef604950cc38b36d6214d0
5
5
  SHA512:
6
- metadata.gz: a088b0f2e24c8afd8a2ec3fd65df4ef5e2d550f55c8376132955db8f870f68a28f021b8079024b413ef2692a474136f3d7da56c098a89d2e3b3aa52deb0ce334
7
- data.tar.gz: d3667e26d54697e09eaefd7cdee7e9c5586e307c371ce41215d8eca88dc514c652079088bba2af3aeb654b9bfbdad3a3ab6080c5f20b47867291cf4734f16cda
6
+ metadata.gz: d3a05d4ccad1f80171a67f0f124cb2d37548803a5451338cb9d821c16042dc94c407f9a4a155597742268cbf8ee939594a166c49835f35f5f4d2ec4d1d9a0567
7
+ data.tar.gz: a287d291ca6465f3c8acfc8cb8c1c5ba898315c6aae80156855153d13a3c7c763864d97127ef38b04331bb7c99b23b417783eada86afdf8c26282c694dfe22bd
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.8.0 (2021-12-29)
6
+
7
+ - Drop Ruby 2.5 support.
8
+
9
+ - Add .isolator_ignore.yml configuration file for Rails application.
10
+
5
11
  ## 0.7.0 (2020-09-25)
6
12
 
7
13
  - Add debug mode. ([@palkan][])
data/README.md CHANGED
@@ -104,7 +104,7 @@ Isolator.configure do |config|
104
104
  end
105
105
  ```
106
106
 
107
- Isolator relys on [uniform_notifier][] to send custom notifications.
107
+ Isolator relies on [uniform_notifier][] to send custom notifications.
108
108
 
109
109
  **NOTE:** `uniform_notifier` should be installed separately (i.e., added to Gemfile).
110
110
 
@@ -115,13 +115,13 @@ Isolator relys on [uniform_notifier][] to send custom notifications.
115
115
 
116
116
  ### Supported ORMs
117
117
 
118
- - `ActiveRecord` >= 4.1
118
+ - `ActiveRecord` >= 5.1 (4.2 likely till works, but we do not test against it anymore)
119
119
  - `ROM::SQL` (only if Active Support instrumentation extension is loaded)
120
120
 
121
121
  ### Adapters
122
122
 
123
123
  Isolator has a bunch of built-in adapters:
124
- - `:http` – built on top of [Sniffer][]
124
+ - `:http` – built on top of [Sniffer][]
125
125
  - `:active_job`
126
126
  - `:sidekiq`
127
127
  - `:resque`
@@ -161,7 +161,7 @@ You can add as many _ignores_ as you want, the offense is registered iff all of
161
161
 
162
162
  ### Using with legacy Rails codebases
163
163
 
164
- If you already have a huge Rails project it can be a tricky to turn Isolator on because you'll immediately get a lot of failed specs. If you want to fix detected issues one by one, you can list all of them in the special file `.isolator_todo.yml` in a following way:
164
+ If you already have a huge Rails project it can be tricky to turn Isolator on because you'll immediately get a lot of failed specs. If you want to fix detected issues one by one, you can list all of them in the special files `.isolator_todo.yml` and `.isolator_ignore.yml` in the following way:
165
165
 
166
166
  ```
167
167
  sidekiq:
@@ -171,6 +171,8 @@ sidekiq:
171
171
 
172
172
  All the exceptions raised in the listed lines will be ignored.
173
173
 
174
+ The `.isolator_todo.yml` file is intended to point to the code that should be fixed later, and `.isolator_ignore.yml` points to the code that for some reasons is not expected to be fixed. (See https://github.com/palkan/isolator/issues/40)
175
+
174
176
  ### Using with legacy Ruby codebases
175
177
 
176
178
  If you are not using Rails, you'll have to load ignores from file manually, using `Isolator::Ignorer.prepare(path:)`, for instance `Isolator::Ignorer.prepare(path: "./config/.isolator_todo.yml")`
@@ -196,7 +198,7 @@ Isolator.isolate :danger, Danger.singleton_class, :explode, options
196
198
  Possible `options` are:
197
199
  - `exception_class` – an exception class to raise in case of offense
198
200
  - `exception_message` – custom exception message (could be specified without a class)
199
- - `details_message` – a block to generate additional exceptin message information:
201
+ - `details_message` – a block to generate additional exception message information:
200
202
 
201
203
  ```ruby
202
204
  Isolator.isolate :active_job,
@@ -28,8 +28,8 @@ module Isolator
28
28
  @ignorer = Isolator::Ignorer
29
29
  end
30
30
 
31
- alias raise_exceptions? raise_exceptions
32
- alias send_notifications? send_notifications
31
+ alias_method :raise_exceptions?, :raise_exceptions
32
+ alias_method :send_notifications?, :send_notifications
33
33
 
34
34
  def test_env?
35
35
  ENV["RACK_ENV"] == "test" || ENV["RAILS_ENV"] == "test"
@@ -16,6 +16,7 @@ module Isolator
16
16
  load File.join(__dir__, "adapters.rb")
17
17
 
18
18
  Isolator.config.ignorer&.prepare
19
+ Isolator.config.ignorer&.prepare(path: ".isolator_ignore.yml")
19
20
 
20
21
  next unless Rails.env.test?
21
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isolator
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/isolator.rb CHANGED
@@ -135,6 +135,13 @@ module Isolator
135
135
  end
136
136
 
137
137
  def decr_transactions!(connection_id = default_connection_id.call)
138
+ current = state[:transactions]&.[](connection_id) || 0
139
+
140
+ if current <= 0
141
+ warn "Trying to finalize an untracked transaction"
142
+ return
143
+ end
144
+
138
145
  state[:transactions][connection_id] -= 1
139
146
 
140
147
  finish! if current_transactions(connection_id) == (connection_threshold(connection_id) - 1)
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: 0.7.0
4
+ version: 0.8.0
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: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2021-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sniffer
@@ -248,6 +248,34 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: webrick
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: net-smtp
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
251
279
  description: Detect non-atomic interactions within DB transactions
252
280
  email:
253
281
  - dementiev.vm@gmail.com
@@ -298,7 +326,7 @@ metadata:
298
326
  documentation_uri: http://github.com/palkan/isolator
299
327
  homepage_uri: http://github.com/palkan/isolator
300
328
  source_code_uri: http://github.com/palkan/isolator
301
- post_install_message:
329
+ post_install_message:
302
330
  rdoc_options: []
303
331
  require_paths:
304
332
  - lib
@@ -306,15 +334,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
334
  requirements:
307
335
  - - ">="
308
336
  - !ruby/object:Gem::Version
309
- version: 2.5.0
337
+ version: 2.6.0
310
338
  required_rubygems_version: !ruby/object:Gem::Requirement
311
339
  requirements:
312
340
  - - ">="
313
341
  - !ruby/object:Gem::Version
314
342
  version: '0'
315
343
  requirements: []
316
- rubygems_version: 3.0.6
317
- signing_key:
344
+ rubygems_version: 3.2.22
345
+ signing_key:
318
346
  specification_version: 4
319
347
  summary: Detect non-atomic interactions within DB transactions
320
348
  test_files: []