Make account lookup faster with sync.Map

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2019-04-23 17:07:12 -07:00
parent 2a7b2a9578
commit bfe83aff81
11 changed files with 303 additions and 108 deletions

View File

@@ -28,7 +28,7 @@ func TestSplitBufferSubOp(t *testing.T) {
if err != nil {
t.Fatalf("Error creating gateways: %v", err)
}
s := &Server{gacc: NewAccount(globalAccountName), accounts: make(map[string]*Account), gateway: gws}
s := &Server{gacc: NewAccount(globalAccountName), gateway: gws}
s.registerAccount(s.gacc)
c := &client{srv: s, acc: s.gacc, msubs: -1, mpay: -1, mcl: 1024, subs: make(map[string]*subscription), nc: cli}
@@ -65,7 +65,7 @@ func TestSplitBufferSubOp(t *testing.T) {
}
func TestSplitBufferUnsubOp(t *testing.T) {
s := &Server{gacc: NewAccount(globalAccountName), accounts: make(map[string]*Account), gateway: &srvGateway{}}
s := &Server{gacc: NewAccount(globalAccountName), gateway: &srvGateway{}}
s.registerAccount(s.gacc)
c := &client{srv: s, acc: s.gacc, msubs: -1, mpay: -1, mcl: 1024, subs: make(map[string]*subscription)}