[telepathy-ashes/master] Exponential backoff on failure.
David Laban
david.laban at collabora.co.uk
Thu Nov 12 16:23:50 PST 2009
---
ashes/tools/bases.py | 2 +-
ashes/tools/echo_daemon.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/ashes/tools/bases.py b/ashes/tools/bases.py
index fadc37f..68031f6 100644
--- a/ashes/tools/bases.py
+++ b/ashes/tools/bases.py
@@ -143,7 +143,7 @@ class ConnectionListener(ObjectListener):
def NameOwnerChanged(self, new_owner):
if new_owner == "":
self.parent.connection_disconnected(self, 2,
- "invalidated: NameOwnerChanged.")
+ "invalidated: NameOwnerChanged")
# FIXME: this should really be auto-generated from the spec globally.
_signal_names = {
diff --git a/ashes/tools/echo_daemon.py b/ashes/tools/echo_daemon.py
index 525d2e8..e9ca069 100644
--- a/ashes/tools/echo_daemon.py
+++ b/ashes/tools/echo_daemon.py
@@ -175,9 +175,13 @@ def do_daemon(account_file):
# of sister processes, we have to pass exit status information as the
# last line of input.
last_line = forward_stream(echo_bot.stdout, echobot_logfile)
+ max_backoff_time = 1
# Re-start the bot until it tells us not to.
while 'replaced' not in last_line:
kill_everything()
+ # Exponential backoff
+ time.sleep(max_backoff_time * random.random() / 1000)
+ max_backoff_time *= 2
echo_bot = start_echo_bot(account_file, True)
echobot_logfile = open("%s/log/echobot-%s-%s.log" %
(HOME, ACCOUNT_NAME, DATE), 'w')
--
1.5.6.5
More information about the telepathy-commits
mailing list