load all nodes into cache

This commit is contained in:
abhishek9686 2024-11-27 14:48:57 +04:00
parent ea2a1488c7
commit cde56204fc
2 changed files with 4 additions and 1 deletions

View file

@ -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
}

View file

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