feat: Optimize batch management and improve performance

- Reduced timeout for RestApiConnector to 20 seconds to ensure timely feedback for previews.
- Implemented caching for external DB metadata to minimize connection overhead and improve response times.
- Enhanced internal DB table and column retrieval with TTL caching to prevent database pool exhaustion.
- Introduced error handling for external DB timeouts, providing clearer feedback to users.
- Updated batch management UI to improve user experience with better error messages and streamlined data handling.

These changes aim to enhance the efficiency and reliability of batch management processes.
This commit is contained in:
kjs
2026-04-23 18:24:32 +09:00
parent c618283306
commit 4a9e3768a9
16 changed files with 305 additions and 216 deletions

View File

@@ -501,12 +501,13 @@ export class BatchManagementController {
});
// RestApiConnector 사용하여 데이터 조회
// 미리보기는 프론트 기본 30초 타임아웃 안에 응답해야 하므로 20초로 제한 — 실패 시 빠르게 피드백
const { RestApiConnector } = await import("../database/RestApiConnector");
const connector = new RestApiConnector({
baseUrl: apiUrl,
apiKey: finalApiKey,
timeout: 30000,
timeout: 20000,
});
// 연결 테스트
@@ -600,15 +601,15 @@ export class BatchManagementController {
}
const data = extractedData.slice(0, 5); // 최대 5개 샘플만
// 미리보기 응답 CPU 부담 줄이기 위해 데이터 본문 로깅은 생략 (개수만 기록)
console.log(
`[previewRestApiData] 슬라이스된 데이터 (${extractedData.length}개 중 ${data.length}개):`,
data
`[previewRestApiData] 샘플 ${data.length}건 추출 (전체 ${extractedData.length}건)`
);
if (data.length > 0) {
// 첫 번째 객체에서 필드명 추출
const fields = Object.keys(data[0]);
console.log(`[previewRestApiData] 추출된 필드:`, fields);
console.log(`[previewRestApiData] 추출된 필드 수: ${fields.length}`);
return res.json({
success: true,