mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
fix: store-query issue in v0.37.0
This commit is contained in:
parent
8133e545be
commit
25737bcb6b
@ -34,7 +34,7 @@ proc defaultTestWakuConfBuilder*(): WakuConfBuilder =
|
||||
@[parseIpAddress("1.1.1.1"), parseIpAddress("1.0.0.1")]
|
||||
)
|
||||
builder.withNatStrategy("any")
|
||||
builder.withMaxConnections(300)
|
||||
builder.withMaxConnections(150)
|
||||
builder.withRelayServiceRatio("50:50")
|
||||
builder.withMaxMessageSize("1024 KiB")
|
||||
builder.withClusterId(DefaultClusterId)
|
||||
|
||||
@ -207,8 +207,8 @@ type WakuNodeConf* = object
|
||||
|
||||
maxConnections* {.
|
||||
desc:
|
||||
"Maximum allowed number of libp2p connections. (Default: 300) can't set it to less than 300",
|
||||
defaultValue: 300,
|
||||
"Maximum allowed number of libp2p connections. (Default: 150) that's recommended value for better connectivity",
|
||||
defaultValue: 150,
|
||||
name: "max-connections"
|
||||
.}: int
|
||||
|
||||
|
||||
@ -587,14 +587,13 @@ proc build*(
|
||||
|
||||
var maxConnections: int
|
||||
if builder.maxConnections.isSome():
|
||||
var mc = builder.maxConnections.get() # mutable to enforce minimum
|
||||
if mc < 300:
|
||||
warn "max-connections less than 300; using default 300", provided = mc
|
||||
mc = 300
|
||||
maxConnections = mc
|
||||
maxConnections = builder.maxConnections.get()
|
||||
if maxConnections < 150:
|
||||
warn "max-connections less than 150; we suggest using 150 or more for better connectivity",
|
||||
provided = maxConnections
|
||||
else:
|
||||
warn "Max Connections was not specified, defaulting to 300"
|
||||
maxConnections = 300
|
||||
warn "Max Connections was not specified, defaulting to 150"
|
||||
maxConnections = 150
|
||||
|
||||
# TODO: Do the git version thing here
|
||||
let agentString = builder.agentString.get("nwaku")
|
||||
|
||||
@ -231,19 +231,8 @@ proc validateNoEmptyStrings(wakuConf: WakuConf): Result[void, string] =
|
||||
|
||||
return ok()
|
||||
|
||||
proc validateMaxConnectionsAndRatio(wakuConf: WakuConf): Result[void, string] =
|
||||
if wakuConf.maxConnections < 300:
|
||||
return
|
||||
err("max-connections must be at least 300, provided " & $wakuConf.maxConnections)
|
||||
if wakuConf.relayServiceRatio != "50:50":
|
||||
return err(
|
||||
"relay-service-ratio must be exactly 50:50, provided " & wakuConf.relayServiceRatio
|
||||
)
|
||||
ok()
|
||||
|
||||
proc validate*(wakuConf: WakuConf): Result[void, string] =
|
||||
?wakuConf.validateNodeKey()
|
||||
?wakuConf.shardingConf.validateShards(wakuConf.subscribeShards)
|
||||
?wakuConf.validateNoEmptyStrings()
|
||||
?wakuConf.validateMaxConnectionsAndRatio()
|
||||
return ok()
|
||||
|
||||
@ -109,12 +109,11 @@ proc queryToAny*(
|
||||
lastError = StoreError(kind: ErrorCode.PEER_DIAL_FAILURE, address: $peer)
|
||||
continue
|
||||
|
||||
let res = await self.sendStoreRequest(request, connection)
|
||||
if res.isOk():
|
||||
return res
|
||||
let response = (await self.sendStoreRequest(request, connection)).valueOr:
|
||||
warn "store query failed, trying next peer", peerId = peer.peerId, error = $error
|
||||
lastError = error
|
||||
continue
|
||||
|
||||
warn "store query failed, trying next peer",
|
||||
peerId = peer.peerId, cause = $res.error
|
||||
lastError = res.error
|
||||
return ok(response)
|
||||
|
||||
return err(lastError)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user