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
bae6385b
Commit
bae6385b
authored
Nov 13, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add simple logging to UpdateMergeRequestsWorker#perform
this is to try to debug #35914
parent
9200b500
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app/workers/update_merge_requests_worker.rb
app/workers/update_merge_requests_worker.rb
+12
-1
spec/workers/update_merge_requests_worker_spec.rb
spec/workers/update_merge_requests_worker_spec.rb
+6
-0
No files found.
app/workers/update_merge_requests_worker.rb
View file @
bae6385b
...
...
@@ -9,6 +9,17 @@ class UpdateMergeRequestsWorker
user
=
User
.
find_by
(
id:
user_id
)
return
unless
user
# TODO: remove this benchmarking when we have rich logging
time
=
Benchmark
.
measure
do
MergeRequests
::
RefreshService
.
new
(
project
,
user
).
execute
(
oldrev
,
newrev
,
ref
)
end
log_args
=
[
"elapsed=
#{
time
.
real
}
"
]
method
(
__method__
).
parameters
.
map
do
|
_
,
p
|
pname
=
p
.
to_s
log_args
<<
[
pname
,
binding
.
local_variable_get
(
pname
)].
join
(
'='
)
end
Rails
.
logger
.
info
(
"UpdateMergeRequestsWorker#perform
#{
log_args
.
join
(
','
)
}
"
)
end
end
spec/workers/update_merge_requests_worker_spec.rb
View file @
bae6385b
...
...
@@ -23,5 +23,11 @@ describe UpdateMergeRequestsWorker do
perform
end
it
'logs performance'
do
expect
(
Rails
.
logger
).
to
receive
(
:info
).
with
(
a_string_matching
(
/\AUpdateMergeRequestsWorker#perform.*project_id=
#{
project
.
id
}
,user_id=
#{
user
.
id
}
,oldrev=
#{
oldrev
}
,newrev=
#{
newrev
}
,ref=
#{
ref
}
/
))
perform
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