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
fd1dccce
Commit
fd1dccce
authored
Jan 06, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an error so that timeouts can be tracked via Sentry
parent
cd9a92a9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
app/workers/chat_notification_worker.rb
app/workers/chat_notification_worker.rb
+4
-1
spec/workers/chat_notification_worker_spec.rb
spec/workers/chat_notification_worker_spec.rb
+6
-2
No files found.
app/workers/chat_notification_worker.rb
View file @
fd1dccce
...
...
@@ -3,6 +3,9 @@
class
ChatNotificationWorker
include
ApplicationWorker
TimeoutExceeded
=
Class
.
new
(
StandardError
)
sidekiq_options
retry:
false
feature_category
:chatops
latency_sensitive_worker!
# TODO: break this into multiple jobs
...
...
@@ -19,7 +22,7 @@ class ChatNotificationWorker
send_response
(
build
)
end
rescue
Gitlab
::
Chat
::
Output
::
MissingBuildSectionError
r
eturn
if
timeout_exceeded?
(
reschedule_count
)
r
aise
TimeoutExceeded
if
timeout_exceeded?
(
reschedule_count
)
# The creation of traces and sections appears to be eventually consistent.
# As a result it's possible for us to run the above code before the trace
...
...
spec/workers/chat_notification_worker_spec.rb
View file @
fd1dccce
...
...
@@ -8,6 +8,10 @@ describe ChatNotificationWorker do
create
(
:ci_build
,
pipeline:
create
(
:ci_pipeline
,
source: :chat
))
end
it
'instructs sidekiq not to retry on failure'
do
expect
(
described_class
.
get_sidekiq_options
[
'retry'
]).
to
eq
(
false
)
end
describe
'#perform'
do
it
'does nothing when the build no longer exists'
do
expect
(
worker
).
not_to
receive
(
:send_response
)
...
...
@@ -36,13 +40,13 @@ describe ChatNotificationWorker do
worker
.
perform
(
chat_build
.
id
)
end
it
"
stops rescheduling the job after
#{
described_class
::
RESCHEDULE_TIMEOUT
}
seconds
"
do
it
"
raises an error after
#{
described_class
::
RESCHEDULE_TIMEOUT
}
seconds of retrying
"
do
allow
(
described_class
).
to
receive
(
:new
).
and_return
(
worker
)
allow
(
worker
).
to
receive
(
:send_response
).
and_raise
(
Gitlab
::
Chat
::
Output
::
MissingBuildSectionError
)
worker
.
perform
(
chat_build
.
id
)
described_class
.
drain
expect
{
described_class
.
drain
}.
to
raise_error
(
described_class
::
TimeoutExceeded
)
max_reschedules
=
described_class
::
RESCHEDULE_TIMEOUT
/
described_class
::
RESCHEDULE_INTERVAL
...
...
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