From be3aa103c5a8fa734850a63626b792d22649e440 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 Mar 2026 07:55:32 -0400 Subject: [PATCH] adds more min_timeout when fetching lots of neighbours --- pyproject.toml | 2 +- src/meshcore/commands/binary.py | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8dcb54d..f149852 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore" -version = "2.3.3" +version = "2.3.4" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, { name="Alex Wolden", email="awolden@gmail.com" }, diff --git a/src/meshcore/commands/binary.py b/src/meshcore/commands/binary.py index ffe5e60..59ebe6b 100644 --- a/src/meshcore/commands/binary.py +++ b/src/meshcore/commands/binary.py @@ -225,6 +225,7 @@ class BinaryCommandHandler(CommandHandlerBase): del res["tag"] + tries = 0 while results_count < neighbours_count: #await asyncio.sleep(2) # wait 2s before next fetch next_res = await self.req_neighbours_sync(contact, @@ -233,15 +234,18 @@ class BinaryCommandHandler(CommandHandlerBase): order_by=order_by, pubkey_prefix_length=pubkey_prefix_length, 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 : - return res # caller should check it has everything - - results_count = results_count + next_res["results_count"] - - res["results_count"] = results_count - res["neighbours"] += next_res["neighbours"] + if tries > 0: + return res # caller should check it has everything + else: + tries += 1 + else: + tries = 0 + results_count += next_res["results_count"] + res["results_count"] = results_count + res["neighbours"] += next_res["neighbours"] return res