From 382da481809dfe5faa2970e560cccf14bb9b4a60 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Mon, 25 Sep 2023 13:01:46 -0700 Subject: [PATCH] The func subjectIsSubsetMatch() is heavy so do without the account lock. Signed-off-by: Derek Collison --- server/accounts.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/accounts.go b/server/accounts.go index 521604f9..ba15dda4 100644 --- a/server/accounts.go +++ b/server/accounts.go @@ -1717,14 +1717,15 @@ func (a *Account) checkForReverseEntries(reply string, checkInterest, recursed b var _rs [64]string rs := _rs[:0] for k := range a.imports.rrMap { - if subjectIsSubsetMatch(k, reply) { - rs = append(rs, k) - } + rs = append(rs, k) } a.mu.RUnlock() + // subjectIsSubsetMatch is heavy so make sure we do this without the lock. for _, r := range rs { - a._checkForReverseEntry(r, nil, checkInterest, recursed) + if subjectIsSubsetMatch(r, reply) { + a._checkForReverseEntry(r, nil, checkInterest, recursed) + } } }