LocalPartition shutdown
This commit is contained in:
@@ -182,14 +182,8 @@ func (p *LocalPartition) MaybeConnectToFollowers(initMessage *mq_pb.PublishMessa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *LocalPartition) MaybeShutdownLocalPartition() (hasShutdown bool) {
|
func (p *LocalPartition) MaybeShutdownLocalPartition() (hasShutdown bool) {
|
||||||
if !p.Publishers.IsEmpty() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !p.Subscribers.IsEmpty() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
p.LogBuffer.ShutdownLogBuffer()
|
|
||||||
|
|
||||||
|
if p.Publishers.IsEmpty() {
|
||||||
if p.followerStream != nil {
|
if p.followerStream != nil {
|
||||||
// send close to the follower
|
// send close to the follower
|
||||||
if followErr := p.followerStream.Send(&mq_pb.PublishFollowMeRequest{
|
if followErr := p.followerStream.Send(&mq_pb.PublishFollowMeRequest{
|
||||||
@@ -203,6 +197,12 @@ func (p *LocalPartition) MaybeShutdownLocalPartition() (hasShutdown bool) {
|
|||||||
p.followerGrpcConnection.Close()
|
p.followerGrpcConnection.Close()
|
||||||
p.followerStream = nil
|
p.followerStream = nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.Publishers.IsEmpty() && p.Subscribers.IsEmpty() {
|
||||||
|
p.LogBuffer.ShutdownLogBuffer()
|
||||||
|
hasShutdown = true
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user