bmuller / txyam

Yet Another Memcached (YAM) client for Python Twisted
Other
10 stars 5 forks source link

Failover timeout #10

Closed Jasim9 closed 8 years ago

Jasim9 commented 8 years ago

I want to know what dead_timeout does the client use by default and is there a way to pass it as a parameter? I was checking the failover and when I bring a failed server backup, I think it takes quite a while for YamClient to start bringing stats from that server.

bmuller commented 8 years ago

That's all controlled by twisted.internet.protocol.ReconnectingClientFactory. There's an exponential back off for retries.

Jasim9 commented 8 years ago

Is there a way to expose the resetDelay function from ReconnectingClientFactory in txyam so that we can control the delay between retries within the application?

bmuller commented 8 years ago

Each of your client's factories (in the factories property) is an instance of MemCacheClientFactory which extends ReconnectingClientFactory. This means that you can do something like:

for factory in client.factories:
     factory.resetDelay() 

though I'm not sure why that's necessary. Why do you need to reset the delay?

Jasim9 commented 8 years ago

It can be useful for implementing a custom timeout if we don't want to use exponential back off. I want a constant timeout of 60 seconds for example, so every 60 seconds I can invoke the resetDelay() and the client will try to reconnect.