MXS-1198: Add configurable listener retry interval
The maximum listener retry interval is now configurable.
This commit is contained in:
@ -146,6 +146,7 @@ SERVICE* service_alloc(const char *name, const char *router)
|
||||
ss_dassert(module);
|
||||
|
||||
service->capabilities = module->module_capabilities;
|
||||
service->max_retry_interval = SERVICE_MAX_RETRY_INTERVAL;
|
||||
service->client_count = 0;
|
||||
service->n_dbref = 0;
|
||||
service->name = my_name;
|
||||
@ -405,7 +406,7 @@ int serviceStartAllPorts(SERVICE* service)
|
||||
service->stats.n_failed_starts++;
|
||||
char taskname[strlen(service->name) + strlen("_start_retry_") +
|
||||
(int) ceil(log10(INT_MAX)) + 1];
|
||||
int retry_after = MXS_MIN(service->stats.n_failed_starts * 10, SERVICE_MAX_RETRY_INTERVAL);
|
||||
int retry_after = MXS_MIN(service->stats.n_failed_starts * 10, service->max_retry_interval);
|
||||
snprintf(taskname, sizeof(taskname), "%s_start_retry_%d",
|
||||
service->name, service->stats.n_failed_starts);
|
||||
hktask_oneshot(taskname, service_internal_restart,
|
||||
@ -994,6 +995,7 @@ serviceClearRouterOptions(SERVICE *service)
|
||||
}
|
||||
spinlock_release(&service->spin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the service user that is used to log in to the backebd servers
|
||||
* associated with this service.
|
||||
@ -1205,6 +1207,12 @@ void serviceSetRetryOnFailure(SERVICE *service, char* value)
|
||||
}
|
||||
}
|
||||
|
||||
void service_set_retry_interval(SERVICE *service, int value)
|
||||
{
|
||||
ss_dassert(value > 0);
|
||||
service->max_retry_interval = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the filters used by the service
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user