This is an automated email from the git hooks/post-receive script.
meskio pushed a change to branch main in repository bridgedb.
from a8b6e1c Prepare for version 0.13.2 new 46127ac Add a delay when retrying to connect to the rdsys backend new ecbbc6f fixup! Add a delay when retrying to connect to the rdsys backend
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: bridgedb/rdsys.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main in repository bridgedb.
commit 46127ac1aa32a8ee81aee65b8d847f3bcc7e5ab6 Author: meskio meskio@torproject.org AuthorDate: Wed May 18 16:44:20 2022 +0200
Add a delay when retrying to connect to the rdsys backend
So we don't fill up the logs with tons of connecting errors.
Closes: rdsys#99 --- bridgedb/rdsys.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/bridgedb/rdsys.py b/bridgedb/rdsys.py index 0aad902..f6ccd4e 100644 --- a/bridgedb/rdsys.py +++ b/bridgedb/rdsys.py @@ -12,6 +12,7 @@ from bridgedb.bridges import Bridge, MalformedBridgeInfo
inter_message_delimiter = b"\r" +max_retry_delay = 60*60 # 1 hour
class RdsysProtocol(Protocol): @@ -98,7 +99,20 @@ def start_stream(distributor, token, rdsys_address, hashring): } agent = Agent(reactor)
+ delay = 1 + + def delayError(err): + nonlocal delay + d = Deferred() + reactor.callLater(delay, d.errback, err) + delay *= 2 + if delay > max_retry_delay: + delay = max_retry_delay + return d + def cbResponse(r): + nonlocal delay + delay = 1 finished = Deferred() r.deliverBody(RdsysProtocol(finished, hashring, distributor)) return finished @@ -118,6 +132,7 @@ def start_stream(distributor, token, rdsys_address, hashring): headers=headers, bodyProducer=body_producer, ) + d.addErrback(delayError) d.addCallback(cbResponse) d.addErrback(lambda err: logging.warning("Error on the connection with rdsys: " + str(err))) d.addCallback(connect)
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main in repository bridgedb.
commit ecbbc6fd04697d573a2174a335618a5e530ac6ff Author: meskio meskio@torproject.org AuthorDate: Sun May 29 22:16:28 2022 +0200
fixup! Add a delay when retrying to connect to the rdsys backend --- bridgedb/rdsys.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bridgedb/rdsys.py b/bridgedb/rdsys.py index f6ccd4e..58c0c8d 100644 --- a/bridgedb/rdsys.py +++ b/bridgedb/rdsys.py @@ -103,6 +103,8 @@ def start_stream(distributor, token, rdsys_address, hashring):
def delayError(err): nonlocal delay + logging.warning("Error on the connection with rdsys, will wait %s seconds to retry: %s" % (delay, str(err))) + d = Deferred() reactor.callLater(delay, d.errback, err) delay *= 2 @@ -134,7 +136,7 @@ def start_stream(distributor, token, rdsys_address, hashring): ) d.addErrback(delayError) d.addCallback(cbResponse) - d.addErrback(lambda err: logging.warning("Error on the connection with rdsys: " + str(err))) + d.addErrback(lambda err: logging.warning("Retry connection to rdsys after error: " + str(err))) d.addCallback(connect)
connect()
tor-commits@lists.torproject.org