mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Fix worker retries and limit default retry timeout to 10 minutes.
Thanks to Christian von Roques for spotting that. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105136 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1025,7 +1025,6 @@ PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
|
||||
const char *url)
|
||||
{
|
||||
char *c, *q, *uri = apr_pstrdup(p, url);
|
||||
apr_status_t rc = 0;
|
||||
|
||||
c = strchr(uri, ':');
|
||||
if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0')
|
||||
@@ -1042,8 +1041,8 @@ PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
|
||||
(*balancer)->workers = apr_array_make(p, 5, sizeof(proxy_runtime_worker));
|
||||
/* XXX Is this a right place to create mutex */
|
||||
#if APR_HAS_THREADS
|
||||
if ((rc = apr_thread_mutex_create(&((*balancer)->mutex),
|
||||
APR_THREAD_MUTEX_DEFAULT, p)) != APR_SUCCESS) {
|
||||
if (apr_thread_mutex_create(&((*balancer)->mutex),
|
||||
APR_THREAD_MUTEX_DEFAULT, p) != APR_SUCCESS) {
|
||||
/* XXX: Do we need to log something here */
|
||||
return "can not create thread mutex";
|
||||
}
|
||||
@@ -1445,8 +1444,13 @@ PROXY_DECLARE(int) ap_proxy_retry_worker(const char *proxy_function,
|
||||
proxy_function, worker->hostname);
|
||||
if (worker->retry)
|
||||
diff = worker->retry;
|
||||
else
|
||||
diff = apr_time_from_sec((60 + 60 * worker->retries++));
|
||||
else {
|
||||
/* Increase the time by 1 minute on each retry */
|
||||
diff = apr_time_from_sec((60 + 60 * worker->retries));
|
||||
/* Use 10 minutes as maximum value for retry */
|
||||
if (worker->retries < 8)
|
||||
++worker->retries;
|
||||
}
|
||||
if (now > worker->error_time + diff) {
|
||||
worker->status &= ~PROXY_WORKER_IN_ERROR;
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||
|
Reference in New Issue
Block a user