fix openclaw gateway connect timeout
This commit is contained in:
parent
68df669576
commit
ce1de28896
@ -10,6 +10,11 @@ import (
|
||||
"xworkmate-bridge/internal/shared"
|
||||
)
|
||||
|
||||
const (
|
||||
productionOpenClawGatewayConnectTimeout = 60 * time.Second
|
||||
productionOpenClawGatewayChallengeTimeout = 30 * time.Second
|
||||
)
|
||||
|
||||
func (s *Server) handleGatewayMethod(ctx context.Context, method string, params map[string]any, notify func(map[string]any)) (map[string]any, *shared.RPCError) {
|
||||
switch method {
|
||||
case "xworkmate.gateway.connect":
|
||||
@ -194,6 +199,7 @@ func ensureProductionGatewayConnected(
|
||||
if server.gateway == nil {
|
||||
server.gateway = gatewayruntime.NewManager()
|
||||
}
|
||||
configureProductionOpenClawGatewayRuntime(server.gateway)
|
||||
|
||||
request := applyProductionGatewayRouting(
|
||||
server,
|
||||
@ -226,4 +232,12 @@ func ensureProductionGatewayConnected(
|
||||
return &shared.RPCError{Code: -32002, Message: "GATEWAY_CONNECT_FAILED: " + message}
|
||||
}
|
||||
|
||||
func configureProductionOpenClawGatewayRuntime(manager *gatewayruntime.Manager) {
|
||||
if manager == nil {
|
||||
return
|
||||
}
|
||||
manager.ConnectTimeout = productionOpenClawGatewayConnectTimeout
|
||||
manager.ChallengeTimeout = productionOpenClawGatewayChallengeTimeout
|
||||
}
|
||||
|
||||
// Helper functions are now in helpers.go
|
||||
|
||||
@ -6,6 +6,23 @@ import (
|
||||
"xworkmate-bridge/internal/gatewayruntime"
|
||||
)
|
||||
|
||||
func TestConfigureProductionOpenClawGatewayRuntimeUsesLongHandshakeWindows(
|
||||
t *testing.T,
|
||||
) {
|
||||
t.Parallel()
|
||||
|
||||
manager := gatewayruntime.NewManager()
|
||||
|
||||
configureProductionOpenClawGatewayRuntime(manager)
|
||||
|
||||
if got := manager.ConnectTimeout; got != productionOpenClawGatewayConnectTimeout {
|
||||
t.Fatalf("ConnectTimeout = %s, want %s", got, productionOpenClawGatewayConnectTimeout)
|
||||
}
|
||||
if got := manager.ChallengeTimeout; got != productionOpenClawGatewayChallengeTimeout {
|
||||
t.Fatalf("ChallengeTimeout = %s, want %s", got, productionOpenClawGatewayChallengeTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveGatewayReportedRemoteAddressUsesBuiltInOpenClawEndpoint(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user