mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Make worker retry algorithm much simpler removing incremental
timeout increase. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105177 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -231,6 +231,8 @@ struct proxy_conn_pool {
|
|||||||
|
|
||||||
#define PROXY_WORKER_IS_USABLE(f) (!((f)->status & 0x00F0))
|
#define PROXY_WORKER_IS_USABLE(f) (!((f)->status & 0x00F0))
|
||||||
|
|
||||||
|
/* default worker retry timeout in seconds */
|
||||||
|
#define PROXY_WORKER_DEFAULT_RETRY 60
|
||||||
|
|
||||||
/* Worker configuration */
|
/* Worker configuration */
|
||||||
struct proxy_worker {
|
struct proxy_worker {
|
||||||
|
@@ -1429,6 +1429,9 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
}
|
}
|
||||||
if (rv == APR_SUCCESS)
|
if (rv == APR_SUCCESS)
|
||||||
worker->status |= PROXY_WORKER_INITIALIZED;
|
worker->status |= PROXY_WORKER_INITIALIZED;
|
||||||
|
/* Set default parameters */
|
||||||
|
if (!worker->retry)
|
||||||
|
worker->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1437,21 +1440,11 @@ PROXY_DECLARE(int) ap_proxy_retry_worker(const char *proxy_function,
|
|||||||
server_rec *s)
|
server_rec *s)
|
||||||
{
|
{
|
||||||
if (worker->status & PROXY_WORKER_IN_ERROR) {
|
if (worker->status & PROXY_WORKER_IN_ERROR) {
|
||||||
apr_interval_time_t diff;
|
|
||||||
apr_time_t now = apr_time_now();
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: retrying the worker for (%s)",
|
"proxy: %s: retrying the worker for (%s)",
|
||||||
proxy_function, worker->hostname);
|
proxy_function, worker->hostname);
|
||||||
if (worker->retry)
|
if (apr_time_now() > worker->error_time + worker->retry) {
|
||||||
diff = worker->retry;
|
|
||||||
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;
|
++worker->retries;
|
||||||
}
|
|
||||||
if (now > worker->error_time + diff) {
|
|
||||||
worker->status &= ~PROXY_WORKER_IN_ERROR;
|
worker->status &= ~PROXY_WORKER_IN_ERROR;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: worker for (%s) has been marked for retry",
|
"proxy: %s: worker for (%s) has been marked for retry",
|
||||||
|
Reference in New Issue
Block a user