If a worker has more than 1000 clients, do not list them in the client list
JSON. cJSON's array addition simply takes way too much CPU.
This commit is contained in:
parent
c65392e5fb
commit
96cc29ed79
|
|
@ -1781,8 +1781,12 @@ int worker_client_list(cJSON *workers, cJSON *clients, cJSON *uplinks, cJSON *pe
|
|||
cJSON_AddNumberToObject(jw, "pbuf_incoming_local_count", w->pbuf_incoming_local_count);
|
||||
|
||||
for (c = w->clients; (c); c = c->next) {
|
||||
client_heard_count += c->client_heard_count;
|
||||
client_courtesy_count += c->client_courtesy_count;
|
||||
|
||||
/* clients on hidden listener sockets are not shown */
|
||||
if (c->hidden)
|
||||
/* if there are a huge amount of clients, don't list them */
|
||||
if (c->hidden || w->client_count > 1000)
|
||||
continue;
|
||||
|
||||
cJSON *jc = cJSON_CreateObject();
|
||||
|
|
@ -1844,8 +1848,6 @@ int worker_client_list(cJSON *workers, cJSON *clients, cJSON *uplinks, cJSON *pe
|
|||
cJSON_AddItemToArray(uplinks, jc);
|
||||
}
|
||||
|
||||
client_heard_count += c->client_heard_count;
|
||||
client_courtesy_count += c->client_courtesy_count;
|
||||
}
|
||||
|
||||
cJSON_AddItemToArray(workers, jw);
|
||||
|
|
|
|||
Loading…
Reference in New Issue