freeMemoryIfNeeded() small refactoring.

Related to issue #5686 and PR #5689.
This commit is contained in:
antirez
2018-12-12 11:37:15 +01:00
parent 7ae184bfea
commit 129f2d2746
4 changed files with 16 additions and 10 deletions

View File

@ -2613,7 +2613,7 @@ int processCommand(client *c) {
* condition, to avoid mixing the propagation of scripts with the
* propagation of DELs due to eviction. */
if (server.maxmemory && !server.lua_timedout) {
int out_of_memory = freeMemoryIfNeeded() == C_ERR;
int out_of_memory = freeMemoryIfNeededAndSafe() == C_ERR;
/* freeMemoryIfNeeded may flush slave output buffers. This may result
* into a slave, that may be the active client, to be freed. */
if (server.current_client == NULL) return C_ERR;