Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 858d8b0

Browse files
updated PING and ECHO stubs
1 parent 2fd8fdd commit 858d8b0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/eval/eval.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,18 @@ func evalSLEEP(args []string, store *dstore.Store) []byte {
144144
}
145145

146146
func evalPING(args []string, store *dstore.Store) []byte {
147-
return nil
147+
// PING command returns PONG if no argument is provided, otherwise it returns the argument
148+
if len(args) == 0 {
149+
return Encode("PONG", false)
150+
}
151+
return Encode(args[0], false)
148152
}
149153

150154
func evalECHO(args []string, store *dstore.Store) []byte {
151-
return nil
155+
if len(args) == 1 {
156+
return diceerrors.NewErrArity("ECHO")
157+
}
158+
return Encode(args[0], false)
152159
}
153160

154161
func evalSET(args []string, store *dstore.Store) *EvalResponse {

0 commit comments

Comments
 (0)