This commit is contained in:
chrislu
2024-03-30 20:37:57 -07:00
parent 0d55bddc75
commit ca4f89a6f6
3 changed files with 4 additions and 17 deletions

View File

@@ -125,7 +125,7 @@ func (p *LocalPartition) closeSubscribers() {
func (p *LocalPartition) WaitUntilNoPublishers() {
for {
if p.Publishers.IsEmpty() {
if p.Publishers.Size() == 0 {
return
}
time.Sleep(113 * time.Millisecond)
@@ -183,7 +183,7 @@ func (p *LocalPartition) MaybeConnectToFollowers(initMessage *mq_pb.PublishMessa
func (p *LocalPartition) MaybeShutdownLocalPartition() (hasShutdown bool) {
if p.Publishers.IsEmpty() {
if p.Publishers.Size() == 0 {
if p.followerStream != nil {
// send close to the follower
if followErr := p.followerStream.Send(&mq_pb.PublishFollowMeRequest{
@@ -196,10 +196,11 @@ func (p *LocalPartition) MaybeShutdownLocalPartition() (hasShutdown bool) {
glog.V(4).Infof("closing grpcConnection to follower")
p.followerGrpcConnection.Close()
p.followerStream = nil
p.follower = ""
}
}
if p.Publishers.IsEmpty() && p.Subscribers.IsEmpty() {
if p.Publishers.Size() == 0 && p.Subscribers.Size() == 0 {
p.LogBuffer.ShutdownLogBuffer()
hasShutdown = true
}