From 62ef29c424b062185021145bf2a51bb93893e818 Mon Sep 17 00:00:00 2001 From: Kelvin Clement Mwinuka Date: Wed, 28 Feb 2024 15:33:39 +0800 Subject: [PATCH] Return empty array for COMMAND DOCS because COMMANDS response triggers error in redis-cli --- src/modules/admin/commands.go | 6 +++++- src/server/modules.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/admin/commands.go b/src/modules/admin/commands.go index 70c017e1..7bdca3d5 100644 --- a/src/modules/admin/commands.go +++ b/src/modules/admin/commands.go @@ -152,6 +152,10 @@ func handleCommandList(ctx context.Context, cmd []string, server utils.Server, _ } } +func handleCommandDocs(ctx context.Context, cmd []string, server utils.Server, _ *net.Conn) ([]byte, error) { + return []byte("*0\r\n"), nil +} + // func handleConfigGet(ctx context.Context, cmd []string, server utils.Server, _ *net.Conn) ([]byte, error) { // return nil, errors.New("command not yet implemented") // } @@ -189,7 +193,7 @@ func Commands() []utils.Command { Description: "Get command documentation", Sync: false, KeyExtractionFunc: func(cmd []string) ([]string, error) { return []string{}, nil }, - HandlerFunc: handleGetAllCommands, + HandlerFunc: handleCommandDocs, }, { Command: "count", diff --git a/src/server/modules.go b/src/server/modules.go index 55b04bad..0dbb704c 100644 --- a/src/server/modules.go +++ b/src/server/modules.go @@ -36,6 +36,8 @@ func (server *Server) handleCommand(ctx context.Context, message []byte, conn *n return nil, err } + fmt.Println(cmd) + command, err := server.getCommand(cmd[0]) if err != nil { return nil, err