cookpad-performance 0.3.1 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b97d8b51a198e5add75ab5630f44ae7390f5d62c9755bb122c036cbf3b95038
|
4
|
+
data.tar.gz: 42626001db703524d4b670de264f116c5074b6a30760714bf943775f95491574
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f3c931186e7046ece11c6abe8d82cccaa9174b6623cffe60b4e0a47541c154b4f964ec6eb247928b4b52f1c7472cd963581eff3fbffabbf31e61b897e4e342
|
7
|
+
data.tar.gz: 3ac2eac28f69e017e2907c709ad660cbd55889d2268432e11508edab76141ce6183af1105546aa9d3649758b378d82f15e76c2b392a365d74aed354f0abc74a8
|
@@ -6,7 +6,8 @@ module Cookpad
|
|
6
6
|
config.to_prepare do
|
7
7
|
if !Rails.env.production? &&
|
8
8
|
(ENV["LOG_N_PLUS_ONE_QUERIES"] == "true" ||
|
9
|
-
|
9
|
+
ENV["RAISE_N_PLUS_ONE_QUERIES"] == "true")
|
10
|
+
require "cookpad/performance/n_plus_one_detection"
|
10
11
|
|
11
12
|
ActionController::Base.include(Cookpad::Performance::NPlusOneDetection)
|
12
13
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cookpad
|
2
|
+
module Performance
|
3
|
+
module NPlusOneDetection
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
around_action :n_plus_one_detection, if: :should_detect_n_plus_ones?
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def should_detect_n_plus_ones?
|
13
|
+
ENV["LOG_N_PLUS_ONE_QUERIES"] == "true" ||
|
14
|
+
ENV["RAISE_N_PLUS_ONE_QUERIES"] == "true"
|
15
|
+
end
|
16
|
+
|
17
|
+
def n_plus_one_detection
|
18
|
+
Prosopite.scan
|
19
|
+
yield
|
20
|
+
ensure
|
21
|
+
Prosopite.finish
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookpad-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cookpad Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prosopite
|
@@ -225,6 +225,7 @@ files:
|
|
225
225
|
- lib/cookpad/performance.rb
|
226
226
|
- lib/cookpad/performance/disable_cached_query_logging.rb
|
227
227
|
- lib/cookpad/performance/engine.rb
|
228
|
+
- lib/cookpad/performance/n_plus_one_detection.rb
|
228
229
|
- lib/cookpad/performance/version.rb
|
229
230
|
homepage: https://github.com/cookpad/cookpad-performance
|
230
231
|
licenses:
|