Compare commits
2 Commits
ea180a7013
...
b44b31307b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b44b31307b | ||
|
|
edd4913ebd |
@@ -6,7 +6,7 @@ spec:
|
|||||||
scaleTargetRef:
|
scaleTargetRef:
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: cart-actor
|
name: cart-actor-amd64
|
||||||
minReplicas: 2
|
minReplicas: 3
|
||||||
maxReplicas: 8
|
maxReplicas: 9
|
||||||
targetCPUUtilizationPercentage: 50
|
targetCPUUtilizationPercentage: 50
|
||||||
@@ -62,6 +62,7 @@ func (m *CartTCPClient) Connect() error {
|
|||||||
|
|
||||||
func (m *CartTCPClient) SendPacket(messageType uint32, id CartId, data []byte) error {
|
func (m *CartTCPClient) SendPacket(messageType uint32, id CartId, data []byte) error {
|
||||||
err := m.Connect()
|
err := m.Connect()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -75,6 +76,7 @@ func (m *CartTCPClient) SendPacket(messageType uint32, id CartId, data []byte) e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = m.Conn.Write(data)
|
_, err = m.Conn.Write(data)
|
||||||
|
m.Conn.SetDeadline(time.Now().Add(time.Second * 10))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +97,7 @@ func (m *CartTCPClient) Call(messageType uint32, id CartId, responseType uint32,
|
|||||||
select {
|
select {
|
||||||
case ret := <-packetChan:
|
case ret := <-packetChan:
|
||||||
return &ret, nil
|
return &ret, nil
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second * 10):
|
||||||
return nil, fmt.Errorf("timeout")
|
return nil, fmt.Errorf("timeout")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ func (m *TCPClient) SendPacket(messageType uint32, data []byte) error {
|
|||||||
return m.HandleConnectionError(err)
|
return m.HandleConnectionError(err)
|
||||||
}
|
}
|
||||||
_, err = m.Conn.Write(data)
|
_, err = m.Conn.Write(data)
|
||||||
|
m.Conn.SetDeadline(time.Now().Add(time.Second * 10))
|
||||||
return m.HandleConnectionError(err)
|
return m.HandleConnectionError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ func (m *TCPClient) Call(messageType uint32, responseType uint32, data []byte) (
|
|||||||
select {
|
select {
|
||||||
case ret := <-packetChan:
|
case ret := <-packetChan:
|
||||||
return &ret, nil
|
return &ret, nil
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second * 10):
|
||||||
return nil, fmt.Errorf("timeout")
|
return nil, fmt.Errorf("timeout")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user