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
896687d4
Commit
896687d4
authored
Jul 02, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update and reduce queries
parent
473b8e7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/alert_management/alert.rb
app/models/alert_management/alert.rb
+2
-2
ee/spec/services/dashboard/operations/list_service_spec.rb
ee/spec/services/dashboard/operations/list_service_spec.rb
+1
-1
No files found.
app/models/alert_management/alert.rb
View file @
896687d4
...
@@ -145,8 +145,8 @@ module AlertManagement
...
@@ -145,8 +145,8 @@ module AlertManagement
end
end
def
self
.
last_prometheus_alert_by_project_id
def
self
.
last_prometheus_alert_by_project_id
ids
=
select
(
arel_table
[
:id
].
maximum
.
as
(
'id'
)).
group
(
:project_id
).
map
(
&
:
id
)
ids
=
select
(
arel_table
[
:id
].
maximum
).
group
(
:project_
id
)
with_prometheus_alert
.
find
(
ids
)
with_prometheus_alert
.
where
(
id:
ids
)
end
end
def
details
def
details
...
...
ee/spec/services/dashboard/operations/list_service_spec.rb
View file @
896687d4
...
@@ -41,7 +41,7 @@ RSpec.describe Dashboard::Operations::ListService do
...
@@ -41,7 +41,7 @@ RSpec.describe Dashboard::Operations::ListService do
it
'ensures a fixed amount of queries'
do
it
'ensures a fixed amount of queries'
do
queries
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}.
count
queries
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}.
count
expect
(
queries
).
to
eq
(
8
)
expect
(
queries
).
to
eq
(
7
)
end
end
end
end
...
...
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