n_plus_one_control 0.7.2 → 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 +2 -2
- data/lib/n_plus_one_control/executor.rb +2 -2
- data/lib/n_plus_one_control/minitest.rb +0 -2
- data/lib/n_plus_one_control/rspec/isolator.rb +11 -0
- data/lib/n_plus_one_control/rspec.rb +1 -0
- data/lib/n_plus_one_control/version.rb +1 -1
- data/lib/n_plus_one_control.rb +1 -1
- metadata +19 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c4f190c6b3f64c1b5678d73108950769bd160f0c48f2dc58b9436bfef040edf
|
|
4
|
+
data.tar.gz: '00083bbb370b0b5a4fabe3a10204532b386a8f33b8423fa51f3535ee9c0e399f'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06fec4e71b034083fb6ea116bb9e903fe29a07dff38ba288be59e4f8930987f95e43d734b6621d1ee7a9a817a2a608db83ea7e6dd2adcd25918a7c30b4d5c2ab
|
|
7
|
+
data.tar.gz: 9fb7bf49b3b29ee58a0ff2651329166022d08747809688f00e59edcfa2d12d49610bd0d082809de02132d19a05f8f3550c7a585001555561e5aa9032a672a083
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -331,7 +331,7 @@ self.show_table_stats = true
|
|
|
331
331
|
# Ignore matching queries
|
|
332
332
|
NPlusOneControl.ignore = /^(BEGIN|COMMIT|SAVEPOINT|RELEASE)/
|
|
333
333
|
|
|
334
|
-
# Ignore queries in cache
|
|
334
|
+
# Ignore queries in cache
|
|
335
335
|
# https://guides.rubyonrails.org/configuring.html#configuring-query-cache
|
|
336
336
|
NPlusOneControl.ignore_cached_queries = false
|
|
337
337
|
|
|
@@ -364,7 +364,7 @@ NPlusOneControl.backtrace_cleaner = ->(locations_array) { do_some_filtering(loca
|
|
|
364
364
|
NPlusOneControl.backtrace_length = 1
|
|
365
365
|
|
|
366
366
|
# Sometime queries could be too large to provide any meaningful insight.
|
|
367
|
-
# You can configure an output length limit for
|
|
367
|
+
# You can configure an output length limit for queries in verbose mode by setting the following option
|
|
368
368
|
# NOTE: It could be specified via NPLUSONE_TRUNCATE env var
|
|
369
369
|
NPlusOneControl.truncate_query_size = 100
|
|
370
370
|
```
|
|
@@ -14,12 +14,12 @@ module NPlusOneControl
|
|
|
14
14
|
@queries = []
|
|
15
15
|
ActiveSupport::Notifications
|
|
16
16
|
.subscribed(method(:callback), NPlusOneControl.event) do
|
|
17
|
-
|
|
17
|
+
yield
|
|
18
18
|
end
|
|
19
19
|
@queries
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def callback(_name, _start, _finish, _message_id, values) # rubocop:disable Metrics/CyclomaticComplexity,
|
|
22
|
+
def callback(_name, _start, _finish, _message_id, values) # rubocop:disable Metrics/CyclomaticComplexity,Layout/LineLength
|
|
23
23
|
return if %w[CACHE SCHEMA].include? values[:name]
|
|
24
24
|
return if values[:sql].match?(NPlusOneControl.ignore)
|
|
25
25
|
return if values[:cached] && NPlusOneControl.ignore_cached_queries
|
|
@@ -12,7 +12,6 @@ module NPlusOneControl
|
|
|
12
12
|
scale_factors: nil,
|
|
13
13
|
warmup: nil
|
|
14
14
|
)
|
|
15
|
-
|
|
16
15
|
raise ArgumentError, "Block is required" unless block_given?
|
|
17
16
|
|
|
18
17
|
warming_up warmup
|
|
@@ -41,7 +40,6 @@ module NPlusOneControl
|
|
|
41
40
|
scale_factors: nil,
|
|
42
41
|
warmup: nil
|
|
43
42
|
)
|
|
44
|
-
|
|
45
43
|
raise ArgumentError, "Block is required" unless block_given?
|
|
46
44
|
|
|
47
45
|
warming_up warmup
|
|
@@ -7,6 +7,7 @@ require "n_plus_one_control/rspec/dsl"
|
|
|
7
7
|
require "n_plus_one_control/rspec/matchers/perform_constant_number_of_queries"
|
|
8
8
|
require "n_plus_one_control/rspec/matchers/perform_linear_number_of_queries"
|
|
9
9
|
require "n_plus_one_control/rspec/context"
|
|
10
|
+
require "n_plus_one_control/rspec/isolator" if defined?(::Isolator)
|
|
10
11
|
|
|
11
12
|
module NPlusOneControl
|
|
12
13
|
module RSpec # :nodoc:
|
data/lib/n_plus_one_control.rb
CHANGED
|
@@ -6,7 +6,7 @@ require "n_plus_one_control/executor"
|
|
|
6
6
|
# RSpec and Minitest matchers to prevent N+1 queries problem.
|
|
7
7
|
module NPlusOneControl
|
|
8
8
|
# Used to extract a table name from a query
|
|
9
|
-
EXTRACT_TABLE_RXP = /(insert into|update|delete from|from) ['"`](\S+)['"`]/i
|
|
9
|
+
EXTRACT_TABLE_RXP = /(insert into|update|delete from|from) ['"`](\S+)['"`]/i
|
|
10
10
|
|
|
11
11
|
# Used to convert a query part extracted by the regexp above to the corresponding
|
|
12
12
|
# human-friendly type
|
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: n_plus_one_control
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- palkan
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: benchmark
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
13
26
|
- !ruby/object:Gem::Dependency
|
|
14
27
|
name: bundler
|
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,6 +113,7 @@ files:
|
|
|
100
113
|
- lib/n_plus_one_control/rspec.rb
|
|
101
114
|
- lib/n_plus_one_control/rspec/context.rb
|
|
102
115
|
- lib/n_plus_one_control/rspec/dsl.rb
|
|
116
|
+
- lib/n_plus_one_control/rspec/isolator.rb
|
|
103
117
|
- lib/n_plus_one_control/rspec/matchers/perform_constant_number_of_queries.rb
|
|
104
118
|
- lib/n_plus_one_control/rspec/matchers/perform_linear_number_of_queries.rb
|
|
105
119
|
- lib/n_plus_one_control/version.rb
|
|
@@ -112,7 +126,6 @@ metadata:
|
|
|
112
126
|
documentation_uri: https://github.com/palkan/n_plus_one_control
|
|
113
127
|
homepage_uri: https://github.com/palkan/n_plus_one_control
|
|
114
128
|
source_code_uri: https://github.com/palkan/n_plus_one_control
|
|
115
|
-
post_install_message:
|
|
116
129
|
rdoc_options: []
|
|
117
130
|
require_paths:
|
|
118
131
|
- lib
|
|
@@ -120,15 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
120
133
|
requirements:
|
|
121
134
|
- - ">="
|
|
122
135
|
- !ruby/object:Gem::Version
|
|
123
|
-
version:
|
|
136
|
+
version: 3.1.0
|
|
124
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
138
|
requirements:
|
|
126
139
|
- - ">="
|
|
127
140
|
- !ruby/object:Gem::Version
|
|
128
141
|
version: '0'
|
|
129
142
|
requirements: []
|
|
130
|
-
rubygems_version: 3.
|
|
131
|
-
signing_key:
|
|
143
|
+
rubygems_version: 3.6.9
|
|
132
144
|
specification_version: 4
|
|
133
145
|
summary: RSpec and Minitest matchers to prevent N+1 queries problem
|
|
134
146
|
test_files: []
|