n_plus_one_control 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e2527bc8ec3ef67b4266b9a7221251d36f29f82697823eb6bba1e301031cd6f
4
- data.tar.gz: b7117a64e62367c75ddd610c3c520ea7472f3d8f80d6e5f228c4642ed3ef2962
3
+ metadata.gz: 62e4c8f58eb8d2e5644c2a99105d17846af7a1d7df6010326ac617b329305af6
4
+ data.tar.gz: e2701d8c11ad8744ceb5ce3eb6b54a06e587e595e9a5cdd0203a42fbcb548059
5
5
  SHA512:
6
- metadata.gz: 29583c392acbdc865b6a01cb1b9e132fe128bf3f9c3b3ced9087b6a58611577315dd4f86fe92ca90f469473ac080fba63f98a95bb771169a34f7d3d39c36f395
7
- data.tar.gz: 752b24bd5bf12d77a89c6fcabfc782e6a0757c98265e519fe1becd1929b058369dd2d545ab3eb6f6c9c4f3eac79e5e099c59c6735247fecf34cde20a6f43cf78
6
+ metadata.gz: 76381aa1bc3f83e407f4cc8694e2133fd1d4b2028dd687c1f9fbb360f7bce943e5aea2939058ba500fcb2a7d7d7498bce484a718a6a7ec85e8de7a300dab7b86
7
+ data.tar.gz: f552c915d68172298a2fa2d14b9325d925bce0b2f2d6e431c2e109134528c684cfb68e6da7a48048346b73c3f371f8fa1c969a58f55a0f5fe3e747854481c321
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
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
+
5
9
  ## 0.7.1 (2023-02-17)
6
10
 
7
11
  - Recognize private `#populate` and `#warmup` methods in Minitest classes. ([@palkan][])
@@ -69,3 +73,4 @@ Could be specified via `NPLUSONE_BACKTRACE` env var.
69
73
  [@caalberts]: https://github.com/caalberts
70
74
  [@andrewhampton]: https://github.com/andrewhampton
71
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NPlusOneControl
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
@@ -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.1
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: 2023-02-17 00:00:00.000000000 Z
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.6
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: []