Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b2b7820d
Commit
b2b7820d
authored
Feb 21, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-02-21
parents
eee43854
561e00b2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
10 deletions
+40
-10
lib/gitlab/query_limiting/active_support_subscriber.rb
lib/gitlab/query_limiting/active_support_subscriber.rb
+4
-2
spec/lib/gitlab/query_limiting/active_support_subscriber_spec.rb
...b/gitlab/query_limiting/active_support_subscriber_spec.rb
+23
-8
yarn.lock
yarn.lock
+13
-0
No files found.
lib/gitlab/query_limiting/active_support_subscriber.rb
View file @
b2b7820d
...
...
@@ -3,9 +3,11 @@ module Gitlab
class
ActiveSupportSubscriber
<
ActiveSupport
::
Subscriber
attach_to
:active_record
def
sql
(
*
)
def
sql
(
event
)
unless
event
.
payload
[
:name
]
==
'CACHE'
Transaction
.
current
&
.
increment
end
end
end
end
end
spec/lib/gitlab/query_limiting/active_support_subscriber_spec.rb
View file @
b2b7820d
require
'spec_helper'
describe
Gitlab
::
QueryLimiting
::
ActiveSupportSubscriber
do
describe
'#sql'
do
it
'increments the number of executed SQL queries'
do
transaction
=
double
(
:transaction
)
let
(
:transaction
)
{
instance_double
(
Gitlab
::
QueryLimiting
::
Transaction
,
increment:
true
)
}
before
do
allow
(
Gitlab
::
QueryLimiting
::
Transaction
)
.
to
receive
(
:current
)
.
and_return
(
transaction
)
end
describe
'#sql'
do
it
'increments the number of executed SQL queries'
do
User
.
count
expect
(
transaction
)
.
to
receive
(
:increment
)
.
at_least
(
:once
)
.
to
have_received
(
:increment
)
.
once
end
context
'when the query is actually a rails cache hit'
do
it
'does not increment the number of executed SQL queries'
do
ActiveRecord
::
Base
.
connection
.
cache
do
User
.
count
User
.
count
end
expect
(
transaction
)
.
to
have_received
(
:increment
)
.
once
end
end
end
end
yarn.lock
View file @
b2b7820d
...
...
@@ -7304,6 +7304,19 @@ resolve-dir@^1.0.0:
expand-tilde "^2.0.0"
global-modules "^1.0.0"
resolve-cwd@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"
dependencies:
resolve-from "^3.0.0"
resolve-dir@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43"
dependencies:
expand-tilde "^2.0.0"
global-modules "^1.0.0"
resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment