added functionality HardCacheDuration to config.ini

This commit is contained in:
partisan 2024-10-16 22:51:13 +02:00
parent 49f613ddeb
commit 8fe6783ecb
7 changed files with 52 additions and 73 deletions

21
init.go
View file

@ -1,6 +1,7 @@
package main
import (
"log"
"time"
)
@ -43,8 +44,7 @@ func main() {
}
loadNodeConfig()
go startFileWatcher()
go checkMasterHeartbeat()
// go checkMasterHeartbeat() // Not currently used
if config.AuthCode == "" {
config.AuthCode = generateStrongRandomString(64)
@ -59,14 +59,17 @@ func main() {
}
config.PeerID = hostID
if len(config.Peers) > 0 {
time.Sleep(2 * time.Second) // Give some time for connections to establish
startElection()
}
// if len(config.Peers) > 0 {
// time.Sleep(2 * time.Second) // Give some time for connections to establish
// startElection()
// }
if config.HardCacheDuration > 0 {
config.HardCacheEnabled = true
}
// Start automatic update checker, not used now
//go checkForUpdates()
generateOpenSearchXML(config)
log.Println("Hard cache:", config.HardCacheEnabled)
go startNodeClient()