Skip to content

Commit

Permalink
fix #1: Check if cluster is initialized before trying to do node oper…
Browse files Browse the repository at this point in the history
…ations (#4)
  • Loading branch information
yaeltzirulnikov authored Feb 24, 2019
1 parent d01eff0 commit a04cc0c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redisraft.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ static int cmdRaftNode(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
RaftReq *req = NULL;
size_t cmd_len;

if (rr->state == REDIS_RAFT_UNINITIALIZED) {
RedisModule_ReplyWithError(ctx, "NOCLUSTER No Raft Cluster");
return REDISMODULE_OK;
}

const char *cmd = RedisModule_StringPtrLen(argv[1], &cmd_len);
if (!strncasecmp(cmd, "ADD", cmd_len)) {
if (argc != 4) {
Expand Down

0 comments on commit a04cc0c

Please sign in to comment.