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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -5
- data/lib/isolator/configuration.rb +2 -2
- data/lib/isolator/railtie.rb +1 -0
- data/lib/isolator/version.rb +1 -1
- data/lib/isolator.rb +7 -0
- metadata +35 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c40700b0b2f7e5025ed7cbfb80580ac9ee1516a1295146bf0fa9db1de6e2a7f
|
4
|
+
data.tar.gz: 7d605d3790733c0b1bcd44e6188c30050900879042ef604950cc38b36d6214d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a05d4ccad1f80171a67f0f124cb2d37548803a5451338cb9d821c16042dc94c407f9a4a155597742268cbf8ee939594a166c49835f35f5f4d2ec4d1d9a0567
|
7
|
+
data.tar.gz: a287d291ca6465f3c8acfc8cb8c1c5ba898315c6aae80156855153d13a3c7c763864d97127ef38b04331bb7c99b23b417783eada86afdf8c26282c694dfe22bd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -104,7 +104,7 @@ Isolator.configure do |config|
|
|
104
104
|
end
|
105
105
|
```
|
106
106
|
|
107
|
-
Isolator
|
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.
|
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` –
|
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
|
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
|
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
|
-
|
32
|
-
|
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"
|
data/lib/isolator/railtie.rb
CHANGED
data/lib/isolator/version.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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: []
|