mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Updates based on feedback
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -489,15 +489,7 @@ func (a *Account) TotalSubs() int {
|
||||
// for the given `subject`. Works only for literal subjects.
|
||||
// TODO: Add support for wildcards
|
||||
func (a *Account) SubscriptionInterest(subject string) bool {
|
||||
var interest bool
|
||||
a.mu.RLock()
|
||||
if a.sl != nil {
|
||||
if res := a.sl.Match(subject); len(res.psubs)+len(res.qsubs) > 0 {
|
||||
interest = true
|
||||
}
|
||||
}
|
||||
a.mu.RUnlock()
|
||||
return interest
|
||||
return a.Interest(subject) > 0
|
||||
}
|
||||
|
||||
// Interest returns the number of subscriptions for a given subject that match.
|
||||
|
||||
@@ -1639,6 +1639,7 @@ func TestLeafNodeOriginClusterInfo(t *testing.T) {
|
||||
// Make sure we disconnect and reconnect.
|
||||
checkLeafNodeConnectedCount(t, s, 0)
|
||||
checkLeafNodeConnected(t, s)
|
||||
checkLeafNodeConnected(t, hub)
|
||||
|
||||
l = grabLeaf()
|
||||
if rc := l.remoteCluster(); rc != "xyz" {
|
||||
|
||||
@@ -3986,7 +3986,7 @@ func TestLeafNodeOriginCluster(t *testing.T) {
|
||||
defer nc3.Close()
|
||||
|
||||
wcSubj := "foo.*"
|
||||
nc3.SubscribeSync(wcSubj)
|
||||
wcsub, _ := nc3.SubscribeSync(wcSubj)
|
||||
// This is a placeholder that we can use to check all interest has propagated.
|
||||
nc3.SubscribeSync("bar")
|
||||
waitForInterest("bar", ln1, ln2, ln3, ca.servers[0], ca.servers[1], ca.servers[2])
|
||||
@@ -4006,6 +4006,11 @@ func TestLeafNodeOriginCluster(t *testing.T) {
|
||||
if n, _, _ := sub.Pending(); n != 1 {
|
||||
t.Fatalf("Expected only one message, got %d", n)
|
||||
}
|
||||
// Also for wc
|
||||
if n, _, _ := wcsub.Pending(); n != 1 {
|
||||
t.Fatalf("Expected only one message, got %d", n)
|
||||
}
|
||||
|
||||
// grab the msg
|
||||
msg, _ := sub.NextMsg(time.Second)
|
||||
if !bytes.Equal(m.Data, msg.Data) {
|
||||
|
||||
Reference in New Issue
Block a user