Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/app/api/redis/command/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export async function POST(request: NextRequest) {
}

// Parse command string into array
const args = command.trim().split(/\s+/);
const result = await redis.call(...args);
const args: string[] = command.trim().split(/\s+/);
const [commandName, ...commandArgs] = args;
const result = await redis.call(commandName, ...commandArgs);

return NextResponse.json({ result });
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/redis/config/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export async function GET(request: NextRequest) {

// Tentar buscar configurações (pode estar desabilitado)
try {
const configs = await redis.config('GET', '*');
const configs = await redis.config('GET', '*') as string[];

// Converter array [key, value, key, value] para objeto
for (let i = 0; i < configs.length; i += 2) {
configObj[configs[i]] = configs[i + 1];
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/redis/keys/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function GET(request: NextRequest) {
}
} else {
// Load limited keys using SCAN
const keys = [];
const keys: Array<{ name: string; type: string; ttl: number; size: number }> = [];
let cursor = '0';
let iterations = 0;
const maxIterations = 100; // Limite de segurança para evitar loops infinitos
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/redis/metrics/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function GET() {
stats.clientRttP95 = latencies.p95;


const metrics = MetricsService.calculateMetrics(stats, sessionId, connectionId);
const metrics = MetricsService.calculateMetrics(stats, sessionId, connectionId ?? undefined);

return NextResponse.json({ metrics });
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/redis/monitor/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function GET(request: NextRequest) {

// Iniciar monitor
console.log('Monitor: Starting monitor command');
monitorRedis.monitor((err, monitor) => {
monitorRedis.monitor((err: Error | null, monitor: any) => {
console.log('Monitor: Callback called', { err: err?.message, hasMonitor: !!monitor });
if (err) {
console.error('Monitor error:', err);
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/redis/slowlog/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function GET(request: NextRequest) {

// Pegar todos os itens do slowlog (ou um número grande suficiente)
// O Redis SLOWLOG retorna em ordem cronológica, não por duração
const allSlowLog = await redis.slowlog('GET', 1000);
const allSlowLog = await redis.slowlog('GET', 1000) as any[];

// Ordenar do mais lento para o menos lento (duração decrescente)
// slowLog format: [id, timestamp, duration, command, clientAddress, clientName]
Expand Down
Loading
Loading