Skip to content

Commit

Permalink
adjust condition postion
Browse files Browse the repository at this point in the history
Signed-off-by: hwware <[email protected]>
  • Loading branch information
hwware committed Nov 20, 2024
1 parent 4986310 commit 42bb918
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/evict.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,13 @@ int performEvictions(void) {
int replicas = listLength(server.replicas);
int result = EVICT_FAIL;

if (getMaxmemoryState(&mem_reported, NULL, &mem_tofree, NULL) == C_OK) {
result = EVICT_OK;
if (server.maxmemory_policy == MAXMEMORY_NO_EVICTION || (iAmPrimary() && server.import_mode)) {
result = EVICT_FAIL; /* We need to free memory, but policy forbids or we are in import mode. */
goto update_metrics;
}

if (server.maxmemory_policy == MAXMEMORY_NO_EVICTION || (iAmPrimary() && server.import_mode)) {
result = EVICT_FAIL; /* We need to free memory, but policy forbids or we are in import mode. */
if (getMaxmemoryState(&mem_reported, NULL, &mem_tofree, NULL) == C_OK) {
result = EVICT_OK;
goto update_metrics;
}

Expand Down

0 comments on commit 42bb918

Please sign in to comment.