fix(redis): unify INFO category command output in cluster mode

* fix(redis):format INFO output as plain text in cluster mode

* fix(redis): unify INFO category command output in cluster mode

In Redis cluster mode, the INFO command (with category parameters) returns aggregated results from multiple primaries. This fix formats the output as human-readable plain text, consistent with standalone mode, to improve readability.

Closes #1326
This commit is contained in:
dalew authored and GitHub committed 2026-06-17 11:20:07 +08:00
1 parent 66e6ca1211
commit 8486d27cb2
2 files changed
+27 -15

No files matched your search

+11
View File
@@ -20,6 +20,17 @@ export function redisCommandResultToQueryResult(value: unknown, elapsedMs: numbe
execution_time_ms: Math.max(0, Math.round(elapsedMs)),
};
}
// INFO commands in cluster mode → [[node_addr, info_text], ...] pairs.
// Render as a two-column table with the addr as the index and info text as the value.
if (Array.isArray(value) && value.length > 0 && value.every((item) => Array.isArray(item) && item.length === 2 && typeof item[0] === "string" && typeof item[1] === "string")) {
const rows: (string | number | boolean | null)[][] = value.map((item: [string, string]) => [item[0], item[1]]);
return {
columns: ["(index)", "value"],
rows,
affected_rows: value.length,
execution_time_ms: Math.max(0, Math.round(elapsedMs)),
};
}
if (Array.isArray(value)) {
const rows: (string | number | boolean | null)[][] = value.map((item, i) => [i + 1, formatRedisCommandResult(item)]);
return {