fix: send the SAMPLES keyword with graph.memoryUsage({ SAMPLES })
Merged
AN
8d ago+29+29+01234567890123456789-5-5-0123456789
graph.memoryUsage({ SAMPLES: 500 }) always failed: the server answered ERR wrong number of arguments for 'graph.MEMORY' command.
GRAPH.MEMORY USAGE takes the sample count as SAMPLES <count> (GRAPH.MEMORY USAGE <graph> [SAMPLES <count>], see FalkorDB's cmd_memory.c), but the client sent the count alone:
GRAPH.MEMORY USAGE g 500 # before: rejected
GRAPH.MEMORY USAGE g SAMPLES 500 # now
The unit tests asserted the wrong arguments, and no test sent SAMPLES to a real server, so this went unnoticed. I found it while running the docs' graph.memory example (FalkorDB/docs#585) against the published 6.9.2.
Changes
MEMORY_USAGEsendsSAMPLES <count>in bothparseCommandandtransformArguments. An explicitSAMPLES: 0is now sent too, so the server clamps it as it does any other value, instead of the client dropping it.- The unit tests in
commands.spec.tsnow expect the correct arguments. - New live test in
single.spec.ts,memoryUsage({ SAMPLES: 500 }). It fails without the fix.
Not breaking: the option never worked, so no working code changes behaviour. Worth shipping in a 6.x patch too.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Bug Fixes
- Corrected memory usage sampling options so sample counts, including
0, are passed with theSAMPLESkeyword.
- Corrected memory usage sampling options so sample counts, including