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
f59032e7
Commit
f59032e7
authored
Dec 07, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'async-services' into 'master'
Async services Fixes #1814 See merge request !1312
parents
2a494d99
0d5265bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
app/models/project.rb
app/models/project.rb
+2
-8
app/models/service.rb
app/models/service.rb
+4
-0
app/workers/project_service_worker.rb
app/workers/project_service_worker.rb
+9
-0
No files found.
app/models/project.rb
View file @
f59032e7
...
...
@@ -390,14 +390,8 @@ class Project < ActiveRecord::Base
end
def
execute_services
(
data
)
services
.
each
do
|
service
|
# Call service hook only if it is active
begin
service
.
execute
(
data
)
if
service
.
active
rescue
=>
e
logger
.
error
(
e
)
end
services
.
select
(
&
:active
).
each
do
|
service
|
service
.
async_execute
(
data
)
end
end
...
...
app/models/service.rb
View file @
f59032e7
...
...
@@ -82,4 +82,8 @@ class Service < ActiveRecord::Base
}
end
end
def
async_execute
(
data
)
Sidekiq
::
Client
.
enqueue
(
ProjectServiceWorker
,
id
,
data
)
end
end
app/workers/project_service_worker.rb
0 → 100644
View file @
f59032e7
class
ProjectServiceWorker
include
Sidekiq
::
Worker
sidekiq_options
queue: :project_web_hook
def
perform
(
hook_id
,
data
)
Service
.
find
(
hook_id
).
execute
(
data
)
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