mirror of
https://github.com/niusmallnan/steve.git
synced 2025-09-13 05:20:19 +00:00
Fix possible context leaks
This commit is contained in:
@@ -150,6 +150,7 @@ func (c *Collection) startStopTemplate(schemas map[string]*types.APISchema) {
|
|||||||
|
|
||||||
subCtx, cancel := context.WithCancel(c.ctx)
|
subCtx, cancel := context.WithCancel(c.ctx)
|
||||||
if err := template.Start(subCtx); err != nil {
|
if err := template.Start(subCtx); err != nil {
|
||||||
|
cancel()
|
||||||
logrus.Errorf("failed to start schema template: %s", id)
|
logrus.Errorf("failed to start schema template: %s", id)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@@ -182,6 +182,7 @@ func (r *RBACStore) Watch(apiOp *types.APIRequest, schema *types.APISchema, w ty
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(apiOp.Context())
|
ctx, cancel := context.WithCancel(apiOp.Context())
|
||||||
|
defer cancel()
|
||||||
apiOp = apiOp.WithContext(ctx)
|
apiOp = apiOp.WithContext(ctx)
|
||||||
|
|
||||||
eg := errgroup.Group{}
|
eg := errgroup.Group{}
|
||||||
|
Reference in New Issue
Block a user