log who owns it
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m28s

This commit is contained in:
matst80
2024-11-12 19:43:19 +01:00
parent 7e0f070637
commit 1616c94f8f
2 changed files with 9 additions and 13 deletions

View File

@@ -18,7 +18,6 @@ const CurrentPacketVersion = 2
type CartListener map[CartId]Listener type CartListener map[CartId]Listener
func NewCartPacketQueue(connection *PersistentConnection) *CartPacketQueue { func NewCartPacketQueue(connection *PersistentConnection) *CartPacketQueue {
queue := &CartPacketQueue{ queue := &CartPacketQueue{
expectedPackages: make(map[CartMessage]*CartListener), expectedPackages: make(map[CartMessage]*CartListener),
} }

View File

@@ -128,7 +128,7 @@ func (p *SyncedPool) RemoveRemoteGrain(id CartId) {
func (p *SyncedPool) SpawnRemoteGrain(id CartId, host string) { func (p *SyncedPool) SpawnRemoteGrain(id CartId, host string) {
if p.local.grains[id] != nil { if p.local.grains[id] != nil {
log.Printf("Grain %s already exists locally, deleting\n", id) log.Printf("Grain %s already exists locally, exists on (%s)\n", id, host)
p.mu.Lock() p.mu.Lock()
delete(p.local.grains, id) delete(p.local.grains, id)
p.mu.Unlock() p.mu.Unlock()
@@ -395,18 +395,15 @@ func (p *SyncedPool) AddRemote(host string) error {
}() }()
go func() { go func() {
for range time.Tick(time.Second * 3) { for range time.Tick(time.Second * 3) {
var err error err := remote.Ping()
err = remote.Ping() for err != nil {
if err != nil { time.Sleep(time.Millisecond * 200)
for err != nil { err = remote.Ping()
time.Sleep(time.Millisecond * 200) if remote.MissedPings > 3 {
err = remote.Ping() log.Printf("Removing host, unable to communicate with %s", host)
if remote.MissedPings > 3 { p.RemoveHost(&remote)
log.Printf("Removing host, unable to communicate with %s", host) return
p.RemoveHost(&remote)
return
}
} }
} }
} }