summaryrefslogtreecommitdiff
path: root/src/where.c
diff options
context:
space:
mode:
authorKamal Mostafa <kamal@whence.com>2012-04-04 20:22:04 +0000
committerKamal Mostafa <kamal@whence.com>2012-04-04 20:22:04 +0000
commit231bb60fc46a7facb554c4fba0c8625158f66cde (patch)
treecd1b739acf4178af40c2a17fbb74b33bae649ac5 /src/where.c
parent21fae3fbbebab7fcb834c25096696fa0dfab09e2 (diff)
downloaddistcc-git-231bb60fc46a7facb554c4fba0c8625158f66cde.tar.gz
Fix for distcc issue 102 <http://code.google.com/p/distcc/issues/detail?id=102>:
"all servers busy" dcc_lock_pause is hardcoded at 1 sec, could be tunable. Makes the pause time tunable via a new env var DISTCC_PAUSE_TIME_MSEC. The default remains set for 1 second.
Diffstat (limited to 'src/where.c')
-rw-r--r--src/where.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/where.c b/src/where.c
index 6e4c5dd..6bd3168 100644
--- a/src/where.c
+++ b/src/where.c
@@ -122,15 +122,20 @@ static void dcc_lock_pause(void)
* really necessary, and also by making jobs complete very-out-of-order is
* more likely to find Makefile bugs. */
- unsigned pause_time = 1;
+ unsigned pause_time_ms = 1000;
+
+ char *pt = getenv("DISTCC_PAUSE_TIME_MSEC");
+ if (pt)
+ pause_time_ms = atoi(pt);
/* This call to dcc_note_state() is made before the host is known, so it
does not make sense and does nothing useful as far as I can tell. */
/* dcc_note_state(DCC_PHASE_BLOCKED, NULL, NULL, DCC_UNKNOWN); */
- rs_trace("nothing available, sleeping %us...", pause_time);
+ rs_trace("nothing available, sleeping %ums...", pause_time_ms);
- sleep(pause_time);
+ if (pause_time_ms > 0)
+ usleep(pause_time_ms * 1000);
}