소스 검색

load all nodes into cache

abhishek9686 9 달 전
부모
커밋
cde56204fc
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 0
      logic/nodes.go
  2. 1 1
      netclient/ncutils/netclientutils.go

+ 3 - 0
logic/nodes.go

@@ -445,6 +445,9 @@ func GetRecordKey(id string, network string) (string, error) {
 
 func GetNodeByID(uuid string) (models.Node, error) {
 	if servercfg.CacheEnabled() {
+		if len(getNodesFromCache()) == 0 {
+			_, _ = GetAllNodes()
+		}
 		if node, ok := getNodeFromCache(uuid); ok {
 			return node, nil
 		}

+ 1 - 1
netclient/ncutils/netclientutils.go

@@ -6,7 +6,7 @@ import (
 )
 
 // DEFAULT_GC_PERCENT - garbage collection percent
-const DEFAULT_GC_PERCENT = 10
+const DEFAULT_GC_PERCENT = 100
 
 // == OS PATH FUNCTIONS ==