mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-07 06:06:08 +00:00
added --subscribe-freq and --subscription-tolerance
This commit is contained in:
@@ -1371,8 +1371,8 @@ healthy:
|
||||
uwsgi_cluster_add_me();
|
||||
}
|
||||
|
||||
// resubscribe every 10 cycles
|
||||
if (uwsgi.subscriptions && ((uwsgi.master_cycles % 10) == 0 || uwsgi.master_cycles == 1)) {
|
||||
// resubscribe every 10 cycles by default
|
||||
if (uwsgi.subscriptions && ((uwsgi.master_cycles % uwsgi.subscribe_freq) == 0 || uwsgi.master_cycles == 1)) {
|
||||
struct uwsgi_string_list *subscriptions = uwsgi.subscriptions;
|
||||
while(subscriptions) {
|
||||
uwsgi_subscribe(subscriptions->value, 0);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define LONG_ARGS_FASTROUTER_TIMEOUT 150006
|
||||
#define LONG_ARGS_FASTROUTER_SUBSCRIPTION_SLOT 150007
|
||||
#define LONG_ARGS_FASTROUTER_USE_CODE_STRING 150008
|
||||
#define LONG_ARGS_FASTROUTER_TOLERANCE 150009
|
||||
|
||||
#define FASTROUTER_STATUS_FREE 0
|
||||
#define FASTROUTER_STATUS_CONNECTING 1
|
||||
@@ -71,6 +72,8 @@ struct uwsgi_fastrouter {
|
||||
|
||||
int cheap;
|
||||
int i_am_cheap;
|
||||
|
||||
int tolerance;
|
||||
} ufr;
|
||||
|
||||
static void fastrouter_go_cheap(void) {
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ struct uwsgi_subscribe_node *uwsgi_get_subscribe_node(struct uwsgi_subscribe_slo
|
||||
struct uwsgi_subscribe_node *node = current_slot->nodes;
|
||||
while(current_slot && node) {
|
||||
// is the node alive ?
|
||||
if (current - node->last_check > 10) {
|
||||
if (current - node->last_check > uwsgi.subscription_tolerance) {
|
||||
node->death_mark = 1;
|
||||
}
|
||||
if (node->death_mark && node->reference == 0) {
|
||||
|
||||
@@ -204,6 +204,9 @@ static struct option long_base_options[] = {
|
||||
{"cluster-log", required_argument, 0, LONG_ARGS_CLUSTER_LOG},
|
||||
#endif
|
||||
{"subscribe-to", required_argument, 0, LONG_ARGS_SUBSCRIBE_TO},
|
||||
{"subscribe", required_argument, 0, LONG_ARGS_SUBSCRIBE_TO},
|
||||
{"subscribe-freq", required_argument, 0, LONG_ARGS_SUBSCRIBE_FREQ},
|
||||
{"subscription-tolerance", required_argument, 0, LONG_ARGS_SUBSCR_TOLERANCE},
|
||||
#ifdef UWSGI_SNMP
|
||||
{"snmp", optional_argument, 0, LONG_ARGS_SNMP},
|
||||
{"snmp-community", required_argument, 0, LONG_ARGS_SNMP_COMMUNITY},
|
||||
@@ -1072,6 +1075,9 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
uwsgi.emperor_throttle = 1000;
|
||||
uwsgi.emperor_pid = -1;
|
||||
|
||||
uwsgi.subscribe_freq = 10;
|
||||
uwsgi.subscription_tolerance = 17;
|
||||
|
||||
uwsgi.cluster_fd = -1;
|
||||
uwsgi.cores = 1;
|
||||
|
||||
@@ -3397,6 +3403,12 @@ static int manage_base_opt(int i, char *optarg) {
|
||||
uwsgi.master_process = 1;
|
||||
uwsgi_string_new_list(&uwsgi.subscriptions, optarg);
|
||||
return 1;
|
||||
case LONG_ARGS_SUBSCR_TOLERANCE:
|
||||
uwsgi.subscription_tolerance = atoi(optarg);
|
||||
return 1;
|
||||
case LONG_ARGS_SUBSCRIBE_FREQ:
|
||||
uwsgi.subscribe_freq = atoi(optarg);
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
case LONG_ARGS_CGROUP:
|
||||
uwsgi_string_new_list(&uwsgi.cgroup, optarg);
|
||||
|
||||
@@ -543,6 +543,8 @@ struct uwsgi_opt {
|
||||
#define LONG_ARGS_SIGNAL 17163
|
||||
#define LONG_ARGS_KSM 17164
|
||||
#define LONG_ARGS_LOGFILE_CHMOD 17165
|
||||
#define LONG_ARGS_SUBSCRIBE_FREQ 17166
|
||||
#define LONG_ARGS_SUBSCR_TOLERANCE 17167
|
||||
|
||||
|
||||
#define UWSGI_OK 0
|
||||
@@ -1527,6 +1529,8 @@ struct uwsgi_server {
|
||||
int startup_daemons_cnt;
|
||||
|
||||
// subscription client
|
||||
int subscribe_freq;
|
||||
int subscription_tolerance;
|
||||
struct uwsgi_string_list *subscriptions;
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
Reference in New Issue
Block a user