summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-07-28 11:10:42 +0200
committerantirez <antirez@gmail.com>2015-07-28 11:10:42 +0200
commit813ff7fdde5d03bfe7109c4a8991fd9509fafd8f (patch)
treed4adbdd4607e4b6cd9ae2fc87c4a797baa5e6d70
parent5cfb792777c18778092334bf251d97b681afda84 (diff)
downloadredis-813ff7fdde5d03bfe7109c4a8991fd9509fafd8f.tar.gz
Avoid magic "0" argument to prepareForShutdown().
Backported from Disque.
-rw-r--r--src/server.c2
-rw-r--r--src/server.h7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/server.c b/src/server.c
index 4a1327997..df8533a96 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1125,7 +1125,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* We received a SIGTERM, shutting down here in a safe way, as it is
* not ok doing so inside the signal handler. */
if (server.shutdown_asap) {
- if (prepareForShutdown(0) == C_OK) exit(0);
+ if (prepareForShutdown(SHUTDOWN_NOFLAGS) == C_OK) exit(0);
serverLog(LL_WARNING,"SIGTERM received but errors trying to shut down the server, check the logs for more information");
server.shutdown_asap = 0;
}
diff --git a/src/server.h b/src/server.h
index b917feab0..78823d0e3 100644
--- a/src/server.h
+++ b/src/server.h
@@ -368,9 +368,10 @@ typedef long long mstime_t; /* millisecond time type. */
#define UNIT_MILLISECONDS 1
/* SHUTDOWN flags */
-#define SHUTDOWN_SAVE 1 /* Force SAVE on SHUTDOWN even if no save
- points are configured. */
-#define SHUTDOWN_NOSAVE 2 /* Don't SAVE on SHUTDOWN. */
+#define SHUTDOWN_NOFLAGS 0 /* No flags. */
+#define SHUTDOWN_SAVE 1 /* Force SAVE on SHUTDOWN even if no save
+ points are configured. */
+#define SHUTDOWN_NOSAVE 2 /* Don't SAVE on SHUTDOWN. */
/* Command call flags, see call() function */
#define CMD_CALL_NONE 0