0

I use ReconnectingClientFactory for implementing client with reconnection feature.

# ... class ClientProtocol(Protocol): def __init__(self, factory): self.factory = factory # ... class ClientFactory(ReconnectingClientFactory): def buildProtocol(self, addr): self.resetDelay() return ClientProtocol(self) def clientConnectionFailed(self, connector, reason): ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason): ReconnectingClientFactory.clientConnectionLost(self, connector, reason) # ... 

It works, but reconnect delay exponentially grows after fail. What's the best way to have two seconds delay?

1 Answer 1

2

Set maxDelay to 2:

class YourClientFactory(ReconnectingClientFactory): maxDelay = 2.0 # ... 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.