2 Commits

Author SHA1 Message Date
matst80
b44b31307b set deadline
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Failing after 29s
Build and Publish / BuildAndDeploy (push) Successful in 2m13s
2024-11-12 13:02:06 +01:00
matst80
edd4913ebd update scaling 2024-11-12 12:46:56 +01:00
3 changed files with 8 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: cart-actor
minReplicas: 2
maxReplicas: 8
name: cart-actor-amd64
minReplicas: 3
maxReplicas: 9
targetCPUUtilizationPercentage: 50

View File

@@ -62,6 +62,7 @@ func (m *CartTCPClient) Connect() error {
func (m *CartTCPClient) SendPacket(messageType uint32, id CartId, data []byte) error {
err := m.Connect()
if err != nil {
return err
}
@@ -75,6 +76,7 @@ func (m *CartTCPClient) SendPacket(messageType uint32, id CartId, data []byte) e
return err
}
_, err = m.Conn.Write(data)
m.Conn.SetDeadline(time.Now().Add(time.Second * 10))
return err
}
@@ -95,7 +97,7 @@ func (m *CartTCPClient) Call(messageType uint32, id CartId, responseType uint32,
select {
case ret := <-packetChan:
return &ret, nil
case <-time.After(time.Second):
case <-time.After(time.Second * 10):
return nil, fmt.Errorf("timeout")
}
}

View File

@@ -81,6 +81,7 @@ func (m *TCPClient) SendPacket(messageType uint32, data []byte) error {
return m.HandleConnectionError(err)
}
_, err = m.Conn.Write(data)
m.Conn.SetDeadline(time.Now().Add(time.Second * 10))
return m.HandleConnectionError(err)
}
@@ -102,7 +103,7 @@ func (m *TCPClient) Call(messageType uint32, responseType uint32, data []byte) (
select {
case ret := <-packetChan:
return &ret, nil
case <-time.After(time.Second):
case <-time.After(time.Second * 10):
return nil, fmt.Errorf("timeout")
}
}