n_plus_one_control 0.7.0 → 0.7.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +4 -0
- data/lib/n_plus_one_control/executor.rb +1 -0
- data/lib/n_plus_one_control/minitest.rb +4 -2
- data/lib/n_plus_one_control/version.rb +1 -1
- data/lib/n_plus_one_control.rb +4 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e4c8f58eb8d2e5644c2a99105d17846af7a1d7df6010326ac617b329305af6
|
4
|
+
data.tar.gz: e2701d8c11ad8744ceb5ce3eb6b54a06e587e595e9a5cdd0203a42fbcb548059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76381aa1bc3f83e407f4cc8694e2133fd1d4b2028dd687c1f9fbb360f7bce943e5aea2939058ba500fcb2a7d7d7498bce484a718a6a7ec85e8de7a300dab7b86
|
7
|
+
data.tar.gz: f552c915d68172298a2fa2d14b9325d925bce0b2f2d6e431c2e109134528c684cfb68e6da7a48048346b73c3f371f8fa1c969a58f55a0f5fe3e747854481c321
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.7.2 (2024-08-06)
|
6
|
+
|
7
|
+
- Add ability to ignore queries cached by the ORM with the new option `ignore_cached_queries` ([@gagalago][])
|
8
|
+
|
9
|
+
## 0.7.1 (2023-02-17)
|
10
|
+
|
11
|
+
- Recognize private `#populate` and `#warmup` methods in Minitest classes. ([@palkan][])
|
12
|
+
|
5
13
|
## 0.7.0 (2023-02-17)
|
6
14
|
|
7
15
|
- Added ability to specify the exact number of expected queries when using constant matchers. ([@akostadinov][], [@palkan][])
|
@@ -65,3 +73,4 @@ Could be specified via `NPLUSONE_BACKTRACE` env var.
|
|
65
73
|
[@caalberts]: https://github.com/caalberts
|
66
74
|
[@andrewhampton]: https://github.com/andrewhampton
|
67
75
|
[@akostadinov]: https://github.com/akostadinov
|
76
|
+
[@gagalago]: https://github.com/gagalago
|
data/README.md
CHANGED
@@ -331,6 +331,10 @@ 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
|
335
|
+
# https://guides.rubyonrails.org/configuring.html#configuring-query-cache
|
336
|
+
NPlusOneControl.ignore_cached_queries = false
|
337
|
+
|
334
338
|
# ActiveSupport notifications event to track queries.
|
335
339
|
# We track ActiveRecord event by default,
|
336
340
|
# but can also track rom-rb events ('sql.rom') as well.
|
@@ -22,6 +22,7 @@ module NPlusOneControl
|
|
22
22
|
def callback(_name, _start, _finish, _message_id, values) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/LineLength
|
23
23
|
return if %w[CACHE SCHEMA].include? values[:name]
|
24
24
|
return if values[:sql].match?(NPlusOneControl.ignore)
|
25
|
+
return if values[:cached] && NPlusOneControl.ignore_cached_queries
|
25
26
|
|
26
27
|
return unless @pattern.nil? || (values[:sql] =~ @pattern)
|
27
28
|
|
@@ -64,11 +64,13 @@ module NPlusOneControl
|
|
64
64
|
private
|
65
65
|
|
66
66
|
def warming_up(warmup)
|
67
|
-
|
67
|
+
own_methods = methods(false) + private_methods(false)
|
68
|
+
(warmup || (own_methods.include?(:warmup) ? method(:warmup) : nil))&.call
|
68
69
|
end
|
69
70
|
|
70
71
|
def population_method
|
71
|
-
methods
|
72
|
+
own_methods = methods(false) + private_methods(false)
|
73
|
+
own_methods.include?(:populate) ? method(:populate) : nil
|
72
74
|
end
|
73
75
|
|
74
76
|
def linear?(queries, slope:)
|
data/lib/n_plus_one_control.rb
CHANGED
@@ -19,7 +19,7 @@ module NPlusOneControl
|
|
19
19
|
|
20
20
|
class << self
|
21
21
|
attr_accessor :default_scale_factors, :verbose, :show_table_stats, :ignore, :event,
|
22
|
-
:backtrace_cleaner, :backtrace_length, :truncate_query_size
|
22
|
+
:backtrace_cleaner, :backtrace_length, :truncate_query_size, :ignore_cached_queries
|
23
23
|
|
24
24
|
attr_reader :default_matching
|
25
25
|
|
@@ -115,6 +115,9 @@ module NPlusOneControl
|
|
115
115
|
# Ignore matching queries
|
116
116
|
self.ignore = /^(BEGIN|COMMIT|SAVEPOINT|RELEASE)/
|
117
117
|
|
118
|
+
# Ignore queries cached
|
119
|
+
self.ignore_cached_queries = false
|
120
|
+
|
118
121
|
# ActiveSupport notifications event to track queries.
|
119
122
|
# We track ActiveRecord event by default,
|
120
123
|
# but can also track rom-rb events ('sql.rom') as well.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: n_plus_one_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,7 +112,7 @@ metadata:
|
|
112
112
|
documentation_uri: https://github.com/palkan/n_plus_one_control
|
113
113
|
homepage_uri: https://github.com/palkan/n_plus_one_control
|
114
114
|
source_code_uri: https://github.com/palkan/n_plus_one_control
|
115
|
-
post_install_message:
|
115
|
+
post_install_message:
|
116
116
|
rdoc_options: []
|
117
117
|
require_paths:
|
118
118
|
- lib
|
@@ -127,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.4.
|
131
|
-
signing_key:
|
130
|
+
rubygems_version: 3.4.19
|
131
|
+
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: RSpec and Minitest matchers to prevent N+1 queries problem
|
134
134
|
test_files: []
|