release local topic partition if no publisher and subscribers

This commit is contained in:
chrislu
2024-01-16 08:43:07 -08:00
parent f782165638
commit 3795d8dca8
4 changed files with 24 additions and 1 deletions

View File

@@ -47,3 +47,10 @@ func (p *LocalPartitionSubscribers) SignalShutdown() {
Subscriber.SignalShutdown()
}
}
func (p *LocalPartitionSubscribers) IsEmpty() bool {
p.SubscribersLock.RLock()
defer p.SubscribersLock.RUnlock()
return len(p.Subscribers) == 0
}