MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / closeClientOnOverload

Function closeClientOnOverload

src/server.cpp:1964–1972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1962}
1963
1964int closeClientOnOverload(client *c) {
1965 if (g_pserver->overload_closed_clients > MAX_CLIENTS_SHED_PER_PERIOD) return false;
1966 if (!g_pserver->is_overloaded) return false;
1967 // Don't close masters, replicas, or pub/sub clients
1968 if (c->flags & (CLIENT_MASTER | CLIENT_SLAVE | CLIENT_PENDING_WRITE | CLIENT_PUBSUB | CLIENT_BLOCKED)) return false;
1969 freeClient(c);
1970 ++g_pserver->overload_closed_clients;
1971 return true;
1972}
1973
1974/* This function is called by serverCron() and is used in order to perform
1975 * operations on clients that are important to perform constantly. For instance

Callers 1

clientsCronFunction · 0.85

Calls 1

freeClientFunction · 0.70

Tested by

no test coverage detected