mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
adds more min_timeout when fetching lots of neighbours
This commit is contained in:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "meshcore"
|
name = "meshcore"
|
||||||
version = "2.3.3"
|
version = "2.3.4"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||||
{ name="Alex Wolden", email="awolden@gmail.com" },
|
{ name="Alex Wolden", email="awolden@gmail.com" },
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ class BinaryCommandHandler(CommandHandlerBase):
|
|||||||
|
|
||||||
del res["tag"]
|
del res["tag"]
|
||||||
|
|
||||||
|
tries = 0
|
||||||
while results_count < neighbours_count:
|
while results_count < neighbours_count:
|
||||||
#await asyncio.sleep(2) # wait 2s before next fetch
|
#await asyncio.sleep(2) # wait 2s before next fetch
|
||||||
next_res = await self.req_neighbours_sync(contact,
|
next_res = await self.req_neighbours_sync(contact,
|
||||||
@@ -233,13 +234,16 @@ class BinaryCommandHandler(CommandHandlerBase):
|
|||||||
order_by=order_by,
|
order_by=order_by,
|
||||||
pubkey_prefix_length=pubkey_prefix_length,
|
pubkey_prefix_length=pubkey_prefix_length,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
min_timeout=min_timeout+5) # requests are close, so let's have some more timeout
|
min_timeout=min_timeout+25) # requests are close and responses big,
|
||||||
|
#so let's have some more timeout for duty cycle
|
||||||
if next_res is None :
|
if next_res is None :
|
||||||
|
if tries > 0:
|
||||||
return res # caller should check it has everything
|
return res # caller should check it has everything
|
||||||
|
else:
|
||||||
results_count = results_count + next_res["results_count"]
|
tries += 1
|
||||||
|
else:
|
||||||
|
tries = 0
|
||||||
|
results_count += next_res["results_count"]
|
||||||
res["results_count"] = results_count
|
res["results_count"] = results_count
|
||||||
res["neighbours"] += next_res["neighbours"]
|
res["neighbours"] += next_res["neighbours"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user