Skip to content

Commit 000a72d

Browse files
committed
Restrict how many retries that lftp will attempt
httpbin.org is being a bit unreliable at the moment and highlighted that lftp is like the little engine that could and it will keep trying and trying. Added restrictions to how many times it will retry.
1 parent 53022c1 commit 000a72d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
1.06 Mon Apr 28 16:49:13 2025
2+
3+
* httpbin.org is being a bit unreliable at the moment
4+
and highlighted that lftp is like the little engine
5+
that could and it will keep trying and trying. Added
6+
restrictions to how many times it will retry.
7+
18
1.04 Tue Jan 18 20:46:04 2022
29

310
* Resolve test warnings reported in GitHub issue #22

lib/File/Fetch.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use vars qw[ $VERBOSE $PREFER_BIN $FROM_EMAIL $USER_AGENT
2323
$FTP_PASSIVE $TIMEOUT $DEBUG $WARN $FORCEIPV4
2424
];
2525

26-
$VERSION = '1.04';
26+
$VERSION = '1.06';
2727
$VERSION = eval $VERSION; # avoid warnings with development releases
2828
$PREFER_BIN = 0; # XXX TODO implement
2929
$FROM_EMAIL = '[email protected]';
@@ -979,6 +979,9 @@ sub _lftp_fetch {
979979
### if a timeout is set, add it ###
980980
$str .= "set net:timeout $TIMEOUT;\n" if $TIMEOUT;
981981

982+
### lftp can get stuck in a loop of retries without this
983+
$str .= "set net:reconnect-interval-base 5;\nset net:max-retries 2;\n";
984+
982985
### run passive if specified ###
983986
$str .= "set ftp:passive-mode 1;\n" if $FTP_PASSIVE;
984987

t/01_File-Fetch.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ $IPC::Cmd::DEBUG = $IPC::Cmd::DEBUG = 1 if $ARGV[0];
1919

2020
$File::Fetch::FORCEIPV4 = $File::Fetch::FORCEIPV4 = 1;
2121

22+
$File::Fetch::TIMOUT = $File::Fetch::TIMEOUT = 30;
23+
2224
unless( $ENV{PERL_CORE} ) {
2325
warn qq[
2426

0 commit comments

Comments
 (0)