From cde56204fcfa3703e14048838432e96f9e6d1f8e Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Wed, 27 Nov 2024 14:48:57 +0400 Subject: [PATCH] load all nodes into cache --- logic/nodes.go | 3 +++ netclient/ncutils/netclientutils.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/logic/nodes.go b/logic/nodes.go index 34eebe2e4..94e7199d5 100644 --- a/logic/nodes.go +++ b/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 } diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index 9f79892d0..23fa9916d 100644 --- a/netclient/ncutils/netclientutils.go +++ b/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 ==