cookpad-performance 0.2.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,8 +6,10 @@ module Cookpad
|
|
6
6
|
config.to_prepare do
|
7
7
|
if !Rails.env.production? &&
|
8
8
|
(ENV["LOG_N_PLUS_ONE_QUERIES"] == "true" ||
|
9
|
-
|
10
|
-
|
9
|
+
ENV["RAISE_N_PLUS_ONE_QUERIES"] == "true")
|
10
|
+
require "cookpad/performance/n_plus_one_detection"
|
11
|
+
|
12
|
+
ActionController::Base.include(Cookpad::Performance::NPlusOneDetection)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
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.2
|
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-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prosopite
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '6.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,7 +208,7 @@ dependencies:
|
|
208
208
|
version: '4.2'
|
209
209
|
description: Provides a set of performance tools for our Rails apps
|
210
210
|
email:
|
211
|
-
-
|
211
|
+
- kaihatsu@cookpad.com
|
212
212
|
executables: []
|
213
213
|
extensions: []
|
214
214
|
extra_rdoc_files: []
|
@@ -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:
|