From 2539bfabb242613f8ec788e6addcebcca576beee Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Thu, 20 Feb 2014 11:55:43 +0100 Subject: Retry wiki page upload on error Change-Id: I9a9621198d4fc02a03ef94eccdddb481109c73fd --- upload-wiki.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/upload-wiki.pl b/upload-wiki.pl index 8a789444b6..58de4fbe03 100755 --- a/upload-wiki.pl +++ b/upload-wiki.pl @@ -134,11 +134,19 @@ sub upload_article { my $text = read_file( $_ ); + RETRY: print "Uploading page '$pagename'\n"; - $mw->edit( { + if ( $mw->edit( { action => 'edit', title => $pagename, - text => $text }, { skip_encoding => 1 } ) || print 'Error: ' . $mw->{error}->{code} . ': ' . $mw->{error}->{details} . "\n"; + text => $text }, { skip_encoding => 1 } ) ) + { + print 'Error: ' . $mw->{error}->{code} . ': ' . $mw->{error}->{details} . "\n"; + print "Waiting for 10 seconds...\n"; + sleep 10; + print "Retry!\n"; + goto RETRY; + } } File::Find::find( {wanted => \&upload_article}, 'wiki/' ); -- cgit