mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-21 07:24:36 +00:00
pubsub: Report a non-nil error when shutting down. (#7309)
If a subscriber arrives while the pubsub service is shutting down, the existing code will return a nil subscription without error. With unlucky timing, this may lead to a nil indirection panic in the RPC service. To avoid that problem, make sure that when a subscription fails for this reason, we report a non-nil error so that the client will detect it and give up gracefully.
This commit is contained in:
@@ -194,7 +194,7 @@ func (s *Server) subscribe(ctx context.Context, clientID string, query Query, ou
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
case <-s.Quit():
|
||||
return nil, nil
|
||||
return nil, errors.New("service is shutting down")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user