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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
91847531
Commit
91847531
authored
Aug 21, 2018
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log project services errors when executing async
parent
fab15563
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
app/workers/project_service_worker.rb
app/workers/project_service_worker.rb
+5
-1
changelogs/unreleased/issue_50528.yml
changelogs/unreleased/issue_50528.yml
+5
-0
spec/workers/project_service_worker_spec.rb
spec/workers/project_service_worker_spec.rb
+25
-0
No files found.
app/workers/project_service_worker.rb
View file @
91847531
...
...
@@ -7,6 +7,10 @@ class ProjectServiceWorker
def
perform
(
hook_id
,
data
)
data
=
data
.
with_indifferent_access
Service
.
find
(
hook_id
).
execute
(
data
)
service
=
Service
.
find
(
hook_id
)
service
.
execute
(
data
)
rescue
=>
error
service_class
=
service
&
.
class
&
.
name
||
"Not Found"
logger
.
error
class:
self
.
class
.
name
,
service_class:
service_class
,
message:
error
.
message
end
end
changelogs/unreleased/issue_50528.yml
0 → 100644
View file @
91847531
---
title
:
Log project services errors when executing async
merge_request
:
author
:
type
:
other
spec/workers/project_service_worker_spec.rb
0 → 100644
View file @
91847531
# frozen_string_literal: true
require
'spec_helper'
describe
ProjectServiceWorker
,
'#perform'
do
let
(
:worker
)
{
described_class
.
new
}
let
(
:service
)
{
JiraService
.
new
}
before
do
allow
(
Service
).
to
receive
(
:find
).
and_return
(
service
)
end
it
'executes service with given data'
do
data
=
{
test:
'test'
}
expect
(
service
).
to
receive
(
:execute
).
with
(
data
)
worker
.
perform
(
1
,
data
)
end
it
'logs error messages'
do
allow
(
service
).
to
receive
(
:execute
).
and_raise
(
StandardError
,
'invalid URL'
)
expect
(
Sidekiq
.
logger
).
to
receive
(
:error
).
with
({
class:
described_class
.
name
,
service_class:
service
.
class
.
name
,
message:
"invalid URL"
})
worker
.
perform
(
1
,
{})
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