permission: increased the LRU cache size for permissions

This commit is contained in:
vsmk98 2019-09-30 16:49:20 +08:00
parent 3242dc85f7
commit 3f88b216b7
2 changed files with 13 additions and 1 deletions

View File

@ -172,7 +172,7 @@ var QIP714BlockReached = false
var networkAdminRole string
var orgAdminRole string
const defaultMapLimit = 100
const defaultMapLimit = 1000000
var OrgInfoMap = NewOrgCache()
var NodeInfoMap = NewNodeCache()

View File

@ -3,6 +3,7 @@ package types
import (
"fmt"
"math/big"
"strconv"
"testing"
"github.com/ethereum/go-ethereum/common"
@ -230,3 +231,14 @@ func TestValidateNodeForTxn_whenUsingOnlyHexNodeId(t *testing.T) {
testifyassert.False(t, txnAllowed)
}
// test the cache limit
func TestLRUCacheLimit(t *testing.T) {
for i := 0; i < defaultMapLimit ; i++ {
orgName := "ORG" + strconv.Itoa(i)
OrgInfoMap.UpsertOrg(orgName, "", NETWORKADMIN, big.NewInt(1), OrgApproved)
}
o := OrgInfoMap.GetOrg("ORG1")
testifyassert.True(t, o != nil)
}