Commit 1dca7eb6 authored by Seth Hoenig's avatar Seth Hoenig
Browse files

consul/connect: use context cancel more safely

parent abd38b3a
Showing with 2 additions and 2 deletions
+2 -2
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment