craps
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 29s
Build and Publish / BuildAndDeploy (push) Successful in 2m25s

This commit is contained in:
matst80
2024-11-13 20:16:40 +01:00
parent dafefa377f
commit 9f7c8227c2
6 changed files with 299 additions and 22 deletions

View File

@@ -2,10 +2,8 @@ package main
import (
"encoding/binary"
"fmt"
"log"
"sync"
"time"
)
type CartClient struct {
@@ -73,13 +71,9 @@ func (m *CartTCPClient) call(messageType CartMessage, id CartId, responseType Ca
if err != nil {
return nil, m.PersistentConnection.HandleConnectionError(err)
}
select {
case ret := <-packetChan:
return &ret, nil
case <-time.After(time.Millisecond * 300):
log.Printf("Timeout waiting for cart response to message type %d\n", responseType)
return nil, m.PersistentConnection.HandleConnectionError(fmt.Errorf("timeout"))
}
ret := <-packetChan
return &ret, nil
}
func isRetirableError(err error) bool {