BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7f27a35e
Commit
7f27a35e
authored
Jan 30, 2017
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-slow-service-fetch' into 'master'
Improve performance of triggered chat commands See merge request !8876
parents
09567e93
9bd424a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
zj-slow-service-fetch.yml
changelogs/unreleased/zj-slow-service-fetch.yml
+4
-0
services.rb
lib/api/services.rb
+10
-3
No files found.
changelogs/unreleased/zj-slow-service-fetch.yml
0 → 100644
View file @
7f27a35e
---
title
:
Improve performance of slash commands
merge_request
:
8876
author
:
lib/api/services.rb
View file @
7f27a35e
...
...
@@ -661,6 +661,14 @@ module API
end
trigger_services
.
each
do
|
service_slug
,
settings
|
helpers
do
def
chat_command_service
(
project
,
service_slug
,
params
)
project
.
services
.
active
.
where
(
template:
false
).
find
do
|
service
|
service
.
try
(
:token
)
==
params
[
:token
]
&&
service
.
to_param
==
service_slug
.
underscore
end
end
end
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
...
...
@@ -679,9 +687,8 @@ module API
# This is not accurate, but done to prevent leakage of the project names
not_found!
(
'Service'
)
unless
project
service
=
project
.
find_or_initialize_service
(
service_slug
.
underscore
)
result
=
service
.
try
(
:active?
)
&&
service
.
try
(
:trigger
,
params
)
service
=
chat_command_service
(
project
,
service_slug
,
params
)
result
=
service
.
try
(
:trigger
,
params
)
if
result
status
result
[
:status
]
||
200
...
...
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