mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-13 02:55:24 +00:00
Don't cancel context of subscribe on method exit
This commit is contained in:
parent
72db28d5ea
commit
8b9bea44c6
@ -129,7 +129,6 @@ func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, wr types
|
|||||||
}
|
}
|
||||||
|
|
||||||
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{}
|
||||||
@ -138,6 +137,7 @@ func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, wr types
|
|||||||
for _, partition := range partitions {
|
for _, partition := range partitions {
|
||||||
store, err := s.Partitioner.Store(apiOp, partition)
|
store, err := s.Partitioner.Store(apiOp, partition)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
cancel()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +158,7 @@ func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, wr types
|
|||||||
defer close(response)
|
defer close(response)
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
eg.Wait()
|
eg.Wait()
|
||||||
|
cancel()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return response, nil
|
return response, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user