Fix possible context leaks

This commit is contained in:
Darren Shepherd
2020-05-22 15:34:59 -07:00
parent a48c49f660
commit a8e9297258
2 changed files with 2 additions and 0 deletions

View File

@@ -150,6 +150,7 @@ func (c *Collection) startStopTemplate(schemas map[string]*types.APISchema) {
subCtx, cancel := context.WithCancel(c.ctx)
if err := template.Start(subCtx); err != nil {
cancel()
logrus.Errorf("failed to start schema template: %s", id)
continue
}

View File

@@ -182,6 +182,7 @@ func (r *RBACStore) Watch(apiOp *types.APIRequest, schema *types.APISchema, w ty
}
ctx, cancel := context.WithCancel(apiOp.Context())
defer cancel()
apiOp = apiOp.WithContext(ctx)
eg := errgroup.Group{}