This commit is contained in:
chrislu
2024-03-27 22:48:37 -07:00
parent 5cc94a05b9
commit 7d87c1d2bb
2 changed files with 18 additions and 12 deletions

View File

@@ -129,6 +129,24 @@ func (p *LocalPartition) WaitUntilNoPublishers() {
}
func (p *LocalPartition) MaybeShutdownLocalPartition() (hasShutdown bool) {
if p.MaybeShutdownLocalPartition() {
if p.FollowerStream != nil {
// send close to the follower
if followErr := p.FollowerStream.Send(&mq_pb.PublishFollowMeRequest{
Message: &mq_pb.PublishFollowMeRequest_Close{
Close: &mq_pb.PublishFollowMeRequest_CloseMessage{},
},
}); followErr != nil {
glog.Errorf("Error closing follower stream: %v", followErr)
}
println("closing grpcConnection to follower")
p.FollowerGrpcConnection.Close()
}
}
return
}
func (p *LocalPartition) canShutdownLocalPartition() (hasShutdown bool) {
if p.Publishers.IsEmpty() && p.Subscribers.IsEmpty() {
p.LogBuffer.ShutdownLogBuffer()
hasShutdown = true