mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 10:12:09 +01:00
Security Enhancements: - Implemented proper rate limiting with automatic cleanup for /register and /forgot-password endpoints - Added memory usage protection with MAX_ENTRIES limit (10000) - Fixed rate limiter memory leaks by adding cleanup intervals - Improved IP extraction with x-real-ip and x-client-ip header support Code Quality Improvements: - Refactored ProcessingStatusManager from individual functions to class-based architecture - Maintained backward compatibility with singleton instance pattern - Fixed TypeScript strict mode violations across the codebase - Resolved all build errors and type mismatches UI Component Fixes: - Removed unused chart components (Charts.tsx, DonutChart.tsx) - Fixed calendar component type issues by removing unused custom implementations - Resolved theme provider type imports - Fixed confetti component default options handling - Corrected pointer component coordinate type definitions Type System Improvements: - Extended NextAuth types to support dual auth systems (regular and platform users) - Fixed nullable type handling throughout the codebase - Resolved Prisma JSON field type compatibility issues - Corrected SessionMessage and ImportRecord interface definitions - Fixed ES2015 iteration compatibility issues Database & Performance: - Updated database pool configuration for Prisma adapter compatibility - Fixed pagination response structure in user management endpoints - Improved error handling with proper error class usage Testing & Build: - All TypeScript compilation errors resolved - ESLint warnings remain but no errors - Build completes successfully with proper static generation
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
import { ProcessingStatusManager } from "./lib/processingStatusManager";
|
|
|
|
const prisma = new PrismaClient();
|
|
const statusManager = new ProcessingStatusManager(prisma);
|
|
|
|
async function checkRefactoredPipelineStatus() {
|
|
try {
|
|
console.log("=== REFACTORED PIPELINE STATUS ===\n");
|
|
|
|
// Get pipeline status using the new system
|
|
const pipelineStatus = await statusManager.getPipelineStatus();
|
|
|
|
console.log(`Total Sessions: ${pipelineStatus.totalSessions}\n`);
|
|
|
|
// Display status for each stage
|
|
const stages = [
|
|
"CSV_IMPORT",
|
|
"TRANSCRIPT_FETCH",
|
|
"SESSION_CREATION",
|
|
"AI_ANALYSIS",
|
|
"QUESTION_EXTRACTION",
|
|
];
|
|
|
|
for (const stage of stages) {
|
|
console.log(`${stage}:`);
|
|
const stageData = pipelineStatus.pipeline[stage] || {};
|
|
|
|
const pending = stageData.PENDING || 0;
|
|
const inProgress = stageData.IN_PROGRESS || 0;
|
|
const completed = stageData.COMPLETED || 0;
|
|
const failed = stageData.FAILED || 0;
|
|
const skipped = stageData.SKIPPED || 0;
|
|
|
|
console.log(` PENDING: ${pending}`);
|
|
console.log(` IN_PROGRESS: ${inProgress}`);
|
|
console.log(` COMPLETED: ${completed}`);
|
|
console.log(` FAILED: ${failed}`);
|
|
console.log(` SKIPPED: ${skipped}`);
|
|
console.log("");
|
|
}
|
|
|
|
// Show what needs processing
|
|
console.log("=== WHAT NEEDS PROCESSING ===");
|
|
|
|
for (const stage of stages) {
|
|
const stageData = pipelineStatus.pipeline[stage] || {};
|
|
const pending = stageData.PENDING || 0;
|
|
const failed = stageData.FAILED || 0;
|
|
|
|
if (pending > 0 || failed > 0) {
|
|
console.log(`• ${stage}: ${pending} pending, ${failed} failed`);
|
|
}
|
|
}
|
|
|
|
// Show failed sessions if any
|
|
const failedSessions = await statusManager.getFailedSessions();
|
|
if (failedSessions.length > 0) {
|
|
console.log("\n=== FAILED SESSIONS ===");
|
|
failedSessions.slice(0, 5).forEach((failure) => {
|
|
console.log(
|
|
` ${failure.session.import?.externalSessionId || failure.sessionId}: ${failure.stage} - ${failure.errorMessage}`
|
|
);
|
|
});
|
|
|
|
if (failedSessions.length > 5) {
|
|
console.log(
|
|
` ... and ${failedSessions.length - 5} more failed sessions`
|
|
);
|
|
}
|
|
}
|
|
|
|
// Show sessions ready for AI processing
|
|
const readyForAI =
|
|
await statusManager.getSessionsNeedingProcessing(
|
|
"AI_ANALYSIS",
|
|
5
|
|
);
|
|
if (readyForAI.length > 0) {
|
|
console.log("\n=== SESSIONS READY FOR AI PROCESSING ===");
|
|
readyForAI.forEach((status) => {
|
|
console.log(
|
|
` ${status.session.import?.externalSessionId || status.sessionId} (created: ${status.session.createdAt})`
|
|
);
|
|
});
|
|
}
|
|
} catch (error) {
|
|
console.error("Error checking pipeline status:", error);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
checkRefactoredPipelineStatus();
|