small cleanup
Some checks failed
Build and Publish / BuildAndDeploy (push) Has been cancelled

This commit is contained in:
matst80
2024-11-09 22:02:03 +01:00
parent eea165a629
commit 14dfabc652

View File

@@ -51,8 +51,8 @@ func NewSyncedPool(local *GrainLocalPool, hostname string, d Discovery) (*Synced
remotes: make([]*RemoteHost, 0), remotes: make([]*RemoteHost, 0),
remoteIndex: make(map[CartId]*RemoteGrainPool), remoteIndex: make(map[CartId]*RemoteGrainPool),
} }
pingTimer := time.NewTicker(time.Second)
go func() { go func(pingTimer *time.Ticker) {
for { for {
<-pingTimer.C <-pingTimer.C
log.Printf("Pinging remotes %d\n", len(pool.remotes)) log.Printf("Pinging remotes %d\n", len(pool.remotes))
@@ -73,10 +73,9 @@ func NewSyncedPool(local *GrainLocalPool, hostname string, d Discovery) (*Synced
} }
connectedRemotes.Set(float64(len(pool.remotes))) connectedRemotes.Set(float64(len(pool.remotes)))
} }
}() }(time.NewTicker(time.Second))
if d != nil { if d != nil {
discoveryTimer := time.NewTicker(time.Second * 5) go func(discoveryTimer *time.Ticker) {
go func() {
<-discoveryTimer.C <-discoveryTimer.C
log.Printf("Looking for new nodes\n") log.Printf("Looking for new nodes\n")
hosts, err := d.Discover() hosts, err := d.Discover()
@@ -117,7 +116,7 @@ func NewSyncedPool(local *GrainLocalPool, hostname string, d Discovery) (*Synced
} }
} }
}() }(time.NewTicker(time.Second * 5))
} }
go func() { go func() {
for { for {