Repository: redis/redis

Issue:
Deprecate QUIT
I propose we officially deprecate `QUIT` and advise clients to drop connections when necessary and not use it. I assume most of the clients do that already, anyway. Terminating a connection on the client side is preferable, as it eliminates `TIME_WAIT` lingering sockets.

@redis/core-team Any thoughts?


Discussion:
Can you share some background on this realization? 
We just promoted it to a command (listed in COMMAND and handled by ACL) a few months ago... 
I see no problem to mark it as deprecated next version, and mention in the redis.io docs right away that it should be avoided, but I feel it's not gonna make any difference. 

Background: some discussions with users who believe it's cleaner to use `QUIT` rather than simply terminate the connection. I don't think the promotion to a first class is conflicting, after all we can't mark it obsolete if it isn't one.
I honestly don't think the effort of introducing a backwards breaking change really justifies changing it. I think we need a more substantive reason to introduce the breaking change. The issue that Yossi mentioned is really just a documentation issue.

One argument I can think to keep it, is that for interactive terminals it reserves a keyword for actually quitting out.
Personally speaking, I am in the habit of exiting `redis-cli` session via issuing the `QUIT` command. I think it is certainly handy to have. Don't see a reason to deprecate it. 
IIRC until recently the QUIT "command" was handled locally in redis-cli (not sending a QUIT command to the server).
anyway, redis-cli usability won't change if we remove that command.
and also, as far as i understand, we're not discussing it's removal, just to mark it as deprecated and advise not to use it.
yes, in redis-cli, quit is handled locally, it just do the exit(0), doesn't issue the QUIT command. a ref: https://github.com/redis/redis/pull/10383
I did not intend to introduce a breaking change, only to document and make sure we drive clients to do the right thing. Luckily, `redis-cli` already sets a good example.
Makes sense. 

If we are not introducing a breaking change for clients then that is fine. I know some clients explicitly sends QUIT commands upon disconnection today. 

Patch:
diff --git a/src/commands.c b/src/commands.c
index c432d0a1201..993650b48c8 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -7164,7 +7164,7 @@ struct redisCommand redisCommandTable[] = {
 {"echo","Echo the given string","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_CONNECTION,ECHO_History,ECHO_tips,echoCommand,2,CMD_LOADING|CMD_STALE|CMD_FAST,ACL_CATEGORY_CONNECTION,.args=ECHO_Args},
 {"hello","Handshake with Redis","O(1)","6.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_CONNECTION,HELLO_History,HELLO_tips,helloCommand,-1,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_FAST|CMD_NO_AUTH|CMD_SENTINEL|CMD_ALLOW_BUSY,ACL_CATEGORY_CONNECTION,.args=HELLO_Args},
 {"ping","Ping the server","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_CONNECTION,PING_History,PING_tips,pingCommand,-1,CMD_FAST|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,.args=PING_Args},
-{"quit","Close the connection","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_CONNECTION,QUIT_History,QUIT_tips,quitCommand,-1,CMD_ALLOW_BUSY|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_FAST|CMD_NO_AUTH,ACL_CATEGORY_CONNECTION},
+{"quit","Close the connection","O(1)","1.0.0",CMD_DOC_DEPRECATED,"just closing the connection","7.2.0",COMMAND_GROUP_CONNECTION,QUIT_History,QUIT_tips,quitCommand,-1,CMD_ALLOW_BUSY|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_FAST|CMD_NO_AUTH,ACL_CATEGORY_CONNECTION},
 {"reset","Reset the connection","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_CONNECTION,RESET_History,RESET_tips,resetCommand,1,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_FAST|CMD_NO_AUTH|CMD_ALLOW_BUSY,ACL_CATEGORY_CONNECTION},
 {"select","Change the selected database for the current connection","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_CONNECTION,SELECT_History,SELECT_tips,selectCommand,2,CMD_LOADING|CMD_STALE|CMD_FAST,ACL_CATEGORY_CONNECTION,.args=SELECT_Args},
 /* generic */
diff --git a/src/commands/quit.json b/src/commands/quit.json
index cf13f1ee91a..cdb80336d04 100644
--- a/src/commands/quit.json
+++ b/src/commands/quit.json
@@ -6,6 +6,11 @@
         "since": "1.0.0",
         "arity": -1,
         "function": "quitCommand",
+        "deprecated_since": "7.2.0",
+        "replaced_by": "just closing the connection",
+        "doc_flags": [
+            "DEPRECATED"
+        ],
         "command_flags": [
             "ALLOW_BUSY",
             "NOSCRIPT",