aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-04-26 07:11:02 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-04-26 07:11:02 +0000
commite58701df90b7b3b8a076300c1db2dca0e49da40b (patch)
tree70497989ab3063371dead87e1d3734106dea89c1
parentc6b4dbedd38c01badc0533c4286ec3ae87fe1885 (diff)
downloadfetchmail-e58701df90b7b3b8a076300c1db2dca0e49da40b.tar.gz
fetchmail-e58701df90b7b3b8a076300c1db2dca0e49da40b.tar.bz2
fetchmail-e58701df90b7b3b8a076300c1db2dca0e49da40b.zip
retry several times to avoid getting jammed by lockbusy.
svn path=/trunk/; revision=2454
-rw-r--r--driver.c8
-rw-r--r--tunable.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/driver.c b/driver.c
index 6bcaf90c..1172ca30 100644
--- a/driver.c
+++ b/driver.c
@@ -2186,6 +2186,7 @@ const struct method *proto; /* protocol method table */
else
{
int totalcount = 0;
+ int lockouts = 0;
int expunge = NUM_VALUE_OUT(ctl->expunge);
int fetchlimit = NUM_VALUE_OUT(ctl->fetchlimit);
@@ -2194,14 +2195,17 @@ const struct method *proto; /* protocol method table */
totalcount += expunge;
if (NUM_SPECIFIED(ctl->fetchlimit) && totalcount >= fetchlimit)
break;
+ if (ok != PS_LOCKBUSY)
+ lockouts = 0;
/*
* Allow time for the server lock to release. if we don't
* do this, we'll often hit a locked-mailbox condition and fail.
*/
- sleep(3); /* to be _really_ safe, probably need sleep(5)! */
+ sleep(3);
} while
- (ok == PS_MAXFETCH);
+ (ok == PS_MAXFETCH
+ || (ok == PS_LOCKBUSY && lockouts++ < MAX_LOCKOUTS));
return(ok);
}
diff --git a/tunable.h b/tunable.h
index 8046afc1..b6abc5f5 100644
--- a/tunable.h
+++ b/tunable.h
@@ -13,5 +13,8 @@
/* maximum consecutive timeouts to accept */
#define MAX_TIMEOUTS 20
+/* maximum consecutive lock-busy errors to accept */
+#define MAX_LOCKOUTS 5
+
/* default skipped message warning interval in seconds */
#define WARNING_INTERVAL 3600