Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVED] The func subjectIsSubsetMatch() is heavy so do without the account lock. #4586

Merged
merged 2 commits into from Sep 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions server/accounts.go
Expand Up @@ -1717,14 +1717,15 @@ func (a *Account) checkForReverseEntries(reply string, checkInterest, recursed b
var _rs [64]string
derekcollison marked this conversation as resolved.
Show resolved Hide resolved
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)
}
}
}

Expand Down