| 1962 | } |
| 1963 | |
| 1964 | int 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 |
no test coverage detected