mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-26 21:01:32 +08:00
load all nodes into cache
This commit is contained in:
@@ -445,6 +445,9 @@ func GetRecordKey(id string, network string) (string, error) {
|
|||||||
|
|
||||||
func GetNodeByID(uuid string) (models.Node, error) {
|
func GetNodeByID(uuid string) (models.Node, error) {
|
||||||
if servercfg.CacheEnabled() {
|
if servercfg.CacheEnabled() {
|
||||||
|
if len(getNodesFromCache()) == 0 {
|
||||||
|
_, _ = GetAllNodes()
|
||||||
|
}
|
||||||
if node, ok := getNodeFromCache(uuid); ok {
|
if node, ok := getNodeFromCache(uuid); ok {
|
||||||
return node, nil
|
return node, nil
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DEFAULT_GC_PERCENT - garbage collection percent
|
// DEFAULT_GC_PERCENT - garbage collection percent
|
||||||
const DEFAULT_GC_PERCENT = 10
|
const DEFAULT_GC_PERCENT = 100
|
||||||
|
|
||||||
// == OS PATH FUNCTIONS ==
|
// == OS PATH FUNCTIONS ==
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user