diff options
author | kamal@whence.com <kamal@whence.com@01de4be4-8c4a-0410-9132-4925637da917> | 2012-04-04 20:28:47 +0000 |
---|---|---|
committer | kamal@whence.com <kamal@whence.com@01de4be4-8c4a-0410-9132-4925637da917> | 2012-04-04 20:28:47 +0000 |
commit | 3b3ae68ddb44aea1d2bf2ba452f8509e223f16d9 (patch) | |
tree | 31d0086c17f15a10d1676a9a7414c37d7a396874 | |
parent | 14171eb36f552625629bf84ec6fd131b1d1e977a (diff) | |
download | distcc-3b3ae68ddb44aea1d2bf2ba452f8509e223f16d9.tar.gz |
Fix for distcc issue 103 <http://code.google.com/p/distcc/issues/detail?id=103>:
hardcoded 60 second backoff period should be tunable
Makes the backoff behavior tunable via a new env var DISTCC_BACKOFF_PERIOD.
The default backoff remains set for 60 seconds.
git-svn-id: http://distcc.googlecode.com/svn/trunk@761 01de4be4-8c4a-0410-9132-4925637da917
-rw-r--r-- | man/distcc.1 | 6 | ||||
-rw-r--r-- | src/backoff.c | 27 |
2 files changed, 31 insertions, 2 deletions
diff --git a/man/distcc.1 b/man/distcc.1 index e335d05..9ab9afb 100644 --- a/man/distcc.1 +++ b/man/distcc.1 @@ -762,6 +762,12 @@ variable is set to 0 then fallbacks are disabled and those compilations will simply fail. Note that this does not affect jobs which must always be local such as linking. .TP +.B "DISTCC_BACKOFF_PERIOD" +Specifies how long (in seconds) distcc will avoid trying to use a +particular compilation server after that server yields a compile +failure. By default set to 60 seconds. To disable the backoff +behavior altogether, set this to 0. +.TP .B "DISTCC_IO_TIMEOUT" Specifies how long (in seconds) distcc will wait before deciding a distributed job has timed out. If a distributed job is expected to diff --git a/src/backoff.c b/src/backoff.c index abc86ed..b3d656c 100644 --- a/src/backoff.c +++ b/src/backoff.c @@ -50,7 +50,7 @@ #include "hosts.h" -const int dcc_backoff_period = 60; /* seconds */ +static int dcc_backoff_period = 60; /* seconds */ /** @@ -61,12 +61,26 @@ const int dcc_backoff_period = 60; /* seconds */ **/ int dcc_enjoyed_host(const struct dcc_hostdef *host) { + char *bp; + + /* special-case: if DISTCC_BACKOFF_PERIOD==0, don't manage backoff files */ + bp = getenv("DISTCC_BACKOFF_PERIOD"); + if (bp && (atoi(bp) == 0)) + return 0; + return dcc_remove_timefile("backoff", host); } int dcc_disliked_host(const struct dcc_hostdef *host) { - /* i hate you (but only for 60 seconds) */ + char *bp; + + /* special-case: if DISTCC_BACKOFF_PERIOD==0, don't manage backoff files */ + bp = getenv("DISTCC_BACKOFF_PERIOD"); + if (bp && (atoi(bp) == 0)) + return 0; + + /* i hate you (but only for dcc_backoff_period seconds) */ return dcc_mark_timefile("backoff", host); } @@ -94,6 +108,15 @@ static int dcc_check_backoff(struct dcc_hostdef *host) int dcc_remove_disliked(struct dcc_hostdef **hostlist) { struct dcc_hostdef *h; + char *bp; + + bp = getenv("DISTCC_BACKOFF_PERIOD"); + if (bp) + dcc_backoff_period = atoi(bp); + + /* special-case: if DISTCC_BACKOFF_PERIOD==0, don't manage backoff files */ + if (dcc_backoff_period == 0) + return 0; while ((h = *hostlist) != NULL) { if (dcc_check_backoff(h) != 0) { |