- /* If we were waiting for an AOF rewrite before to start appending
- * to the AOF again (this happens both when the user switches on
- * AOF with CONFIG SET, and after a slave with AOF enabled syncs with
- * the master), but the rewrite failed (otherwise aof_wait_rewrite
- * would be zero), we need to schedule a new one. */
- if (server.aof_wait_rewrite) server.aofrewrite_scheduled = 1;
+ /* Schedule a new rewrite if we are waiting for it to switch the AOF ON. */
+ if (server.aof_state == REDIS_AOF_WAIT_REWRITE)
+ server.aofrewrite_scheduled = 1;