Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Agents poll AETHERFORGE_CLOUD_MAP_ENDPOINT to sync know_node gossip; deploy plans attach route_via DNS hints for standalone operator registries.
42 lines
839 B
Go
42 lines
839 B
Go
package client
|
|
|
|
import (
|
|
"log"
|
|
"time"
|
|
|
|
"crypto-miner-agent/deploy"
|
|
)
|
|
|
|
const cloudMapSyncInterval = 5 * time.Minute
|
|
|
|
func (c *AgentClient) startCloudMapSync() {
|
|
endpoint := deploy.CloudMapEndpoint()
|
|
if endpoint == "" {
|
|
return
|
|
}
|
|
go c.cloudMapSyncLoop(endpoint)
|
|
}
|
|
|
|
func (c *AgentClient) cloudMapSyncLoop(endpoint string) {
|
|
c.syncCloudMapOnce(endpoint)
|
|
ticker := time.NewTicker(cloudMapSyncInterval)
|
|
defer ticker.Stop()
|
|
for {
|
|
select {
|
|
case <-c.miningCtx.Done():
|
|
return
|
|
case <-ticker.C:
|
|
c.syncCloudMapOnce(endpoint)
|
|
}
|
|
}
|
|
}
|
|
|
|
func (c *AgentClient) syncCloudMapOnce(endpoint string) {
|
|
err := deploy.SyncCloudMapRegistry(endpoint, c.writeFleetTorrentGossip)
|
|
if err != nil {
|
|
log.Printf("[agent] cloud map registry sync failed: %v", err)
|
|
return
|
|
}
|
|
log.Printf("[agent] cloud map registry synced from %s", endpoint)
|
|
}
|