[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] CA-36633: backoff delay when retrying master connection



# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1266426911 0
# Node ID 87b760a0d42c2182afaec305c5cb437540832fbc
# Parent  6d66c87993de600782428fecd670a43c8d67601e
CA-36633: backoff delay when retrying master connection

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

diff -r 6d66c87993de -r 87b760a0d42c ocaml/database/master_connection.ml
--- a/ocaml/database/master_connection.ml       Wed Feb 17 17:15:11 2010 +0000
+++ b/ocaml/database/master_connection.ml       Wed Feb 17 17:15:11 2010 +0000
@@ -112,6 +112,12 @@
   let write_ok = ref false in
   let result = ref (Xml.PCData "") in
   let surpress_no_timeout_logs = ref false in
+  let backoff_delay = ref 2.0 in (* initial delay = 2s *)
+  let update_backoff_delay () =
+    backoff_delay := !backoff_delay *. 2.0;
+    if !backoff_delay < 2.0 then backoff_delay := 2.0 
+    else if !backoff_delay > 256.0 then backoff_delay := 256.0
+  in  
   while (not !write_ok)
   do
     begin
@@ -175,7 +181,9 @@
                    raise Cannot_connect_to_master
                  end
              end;
-           Thread.delay 2.0;
+           debug "Sleeping %f seconds before retrying master connection..." 
!backoff_delay;
+           Thread.delay !backoff_delay;
+           update_backoff_delay ();
            try
              open_secure_connection()
            with _ -> () (* oh well, maybe nextime... *)
1 file changed, 9 insertions(+), 1 deletion(-)
ocaml/database/master_connection.ml |   10 +++++++++-


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.