Search/node-update.go
partisan f769f70ce7 wip
2024-07-05 03:08:35 +02:00

23 lines
624 B
Go

package main
import (
"fmt"
"log"
"time"
)
// Function to sync updates across all nodes
func nodeUpdateSync() {
fmt.Println("Syncing updates across all nodes...")
for _, peer := range peers {
fmt.Printf("Notifying node %s about update...\n", peer)
err := sendMessage(peer, authCode, "update", "Start update process")
if err != nil {
log.Printf("Failed to notify node %s: %v\n", peer, err)
continue
}
fmt.Printf("Node %s notified. Waiting for it to update...\n", peer)
time.Sleep(30 * time.Second) // Adjust sleep time as needed to allow for updates
}
fmt.Println("All nodes have been updated.")
}