From f8ea650b922ba5622debdf6a49121388e2a32e2d Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Tue, 14 Mar 2023 12:02:32 -0400 Subject: [PATCH] Wait for current loop iteration to finish before moving on to next iteration. --- src/allmydata/storage_client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py index 5dd906005..faa48710f 100644 --- a/src/allmydata/storage_client.py +++ b/src/allmydata/storage_client.py @@ -1239,9 +1239,13 @@ class HTTPNativeStorageServer(service.MultiService): self._failed_to_connect ) - # TODO Make sure LoopingCall waits for the above timeout for looping again: - # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3981 - #return self._connecting_deferred or maye await it + # We don't want to do another iteration of the loop until this + # iteration has finished, so wait here: + try: + if self._connecting_deferred is not None: + await self._connecting_deferred + except Exception as e: + log.msg(f"Failed to connect to a HTTP storage server: {e}", level=log.CURIOUS) def stopService(self): if self._connecting_deferred is not None: