Skip to content

Commit

Permalink
load all nodes into cache
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Nov 27, 2024
1 parent ea2a148 commit cde5620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions logic/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion netclient/ncutils/netclientutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// DEFAULT_GC_PERCENT - garbage collection percent
const DEFAULT_GC_PERCENT = 10
const DEFAULT_GC_PERCENT = 100

// == OS PATH FUNCTIONS ==

Expand Down

0 comments on commit cde5620

Please sign in to comment.