瀏覽代碼

get all nodes on startup

abhishek9686 9 月之前
父節點
當前提交
cbe660fbf2
共有 2 個文件被更改,包括 1 次插入3 次删除
  1. 0 3
      logic/nodes.go
  2. 1 0
      migrate/migrate.go

+ 0 - 3
logic/nodes.go

@@ -445,9 +445,6 @@ 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
 		}
 		}

+ 1 - 0
migrate/migrate.go

@@ -20,6 +20,7 @@ import (
 
 
 // Run - runs all migrations
 // Run - runs all migrations
 func Run() {
 func Run() {
+	_, _ = logic.GetAllNodes()
 	updateEnrollmentKeys()
 	updateEnrollmentKeys()
 	assignSuperAdmin()
 	assignSuperAdmin()
 	createDefaultTagsAndPolicies()
 	createDefaultTagsAndPolicies()