From 38bcc2ff2744081890538377ad5c3977ae139cfe Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 15 Aug 2011 04:37:15 +0000 Subject: [PATCH] * retry when there is a failure --- fb_upload | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/fb_upload b/fb_upload index f46e87d..b33a84e 100755 --- a/fb_upload +++ b/fb_upload @@ -140,12 +140,19 @@ else { for my $photo (@photos) { print "Uploading $photo"; - my $response = - $client->photos->upload(aid => $aid, - data => scalar read_file($photo), - caption => '', - filename => basename($photo), - ); + my $response; + my $try=0; + while (not $response = + $client->photos->upload(aid => $aid, + data => scalar read_file($photo), + caption => '', + filename => basename($photo), + )) { + $try++; + print " [failure $try] "; + sleep 3; + last if $try > 10; + } if (not $response) { die "Upload failure at photo $photo"; } -- 2.39.2