diff --git a/pkg/schema/collection.go b/pkg/schema/collection.go index 319d19c..ce0324e 100644 --- a/pkg/schema/collection.go +++ b/pkg/schema/collection.go @@ -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 } diff --git a/pkg/server/store/proxy/rbac_store.go b/pkg/server/store/proxy/rbac_store.go index a888e12..65ebfda 100644 --- a/pkg/server/store/proxy/rbac_store.go +++ b/pkg/server/store/proxy/rbac_store.go @@ -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{}