Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
1dca7eb6
Commit
1dca7eb6
authored
4 years ago
by
Seth Hoenig
Browse files
Options
Download
Email Patches
Plain Diff
consul/connect: use context cancel more safely
parent
abd38b3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nomad/job_endpoint.go
+2
-2
nomad/job_endpoint.go
with
2 additions
and
2 deletions
+2
-2
nomad/job_endpoint.go
+
2
-
2
View file @
1dca7eb6
...
...
@@ -285,12 +285,12 @@ func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegis
// submitted if the configuration entries cannot be set in Consul.
//
// Every job update will re-write the Configuration Entry into Consul.
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
for
service
,
entry
:=
range
args
.
Job
.
ConfigEntries
()
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
if
err
:=
j
.
srv
.
consulConfigEntries
.
SetIngressGatewayConfigEntry
(
ctx
,
service
,
entry
);
err
!=
nil
{
return
err
}
cancel
()
}
// Enforce Sentinel policies. Pass a copy of the job to prevent
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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