[ARVADOS] updated: 7e35706c5532061c6720b64645e491a4cff505ef

git at public.curoverse.com git at public.curoverse.com
Mon Oct 6 11:36:20 EDT 2014


Summary of changes:
 sdk/cli/bin/crunch-job | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

       via  7e35706c5532061c6720b64645e491a4cff505ef (commit)
      from  75955af3fc2740a75a7779d76965aac13214c0ca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7e35706c5532061c6720b64645e491a4cff505ef
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Oct 6 11:38:20 2014 -0400

    4012: Calculate backoff smarter based on code review.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index 43d881c..1b56785 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -1543,21 +1543,23 @@ sub retry_count {
 }
 
 sub retry_op {
-  # Given a function reference, call it with the given arguments.  If
+  # Given a function reference, call it with the remaining arguments.  If
   # it dies, retry it with exponential backoff until it succeeds, or until
   # the current retry_count is exhausted.
   my $operation = shift;
-  foreach my $try_count (0..retry_count()) {
+  my $retries = retry_count();
+  foreach my $try_count (0..$retries) {
+    my $next_try = time + (2 ** $try_count);
     my $result = eval { $operation->(@_); };
-    if ($@) {
-      sleep(2 ** $try_count);
+    if ($@ && ($try_count < $retries)) {
+      sleep(time - $next_try);
     } else {
       return $result;
     }
   }
   # Ensure the error message ends in a newline, so Perl doesn't add
   # retry_op's line number to it.
-  chomp $@;
+  chomp($@);
   die($@ . "\n");
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list