@@ -347,7 +347,6 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
347347 }
348348
349349 logger . info ( `[${ tableName } ] 시작: ${ recordCnt . toLocaleString ( ) } 행, ${ columns . length } 컬럼` )
350- const startTime = Date . now ( )
351350 let totalProcessed = 0
352351 const numChunks = Math . max ( 1 , Math . ceil ( recordCnt / CHUNK_SIZE ) )
353352
@@ -359,22 +358,16 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
359358 continue
360359 }
361360
362- logger . info ( `\n[${ tableName } ] 청크 ${ chunkIdx + 1 } /${ numChunks } 처리 중 (${ chunkSize } 행)` )
363- const chunkStartTime = Date . now ( )
364-
365361 const columnStreams = columns . map ( ( col ) => createColumnStream ( col , task , chunkSize ) )
366362 const { aiColumns, nonAiColumns } = separateColumnsByType ( columns )
367363 const chunkColumnValues : ( string | typeof INVALID ) [ ] [ ] = new Array ( columns . length )
368364
369365 // === Non-AI 컬럼 처리 (예외 처리 일관화) ===
370366 if ( nonAiColumns . length > 0 ) {
371- logger . info ( `[${ tableName } ] Non-AI 컬럼 동시 처리:` )
372367 const nonAiResults = await Promise . all (
373368 nonAiColumns . map ( async ( colIdx ) => {
374369 const col = columns [ colIdx ]
375370 const stream = columnStreams [ colIdx ]
376- const colStart = Date . now ( )
377- logger . info ( ` ▶ [${ col . columnName } ] 처리 (${ col . dataSource } )` )
378371
379372 const values : ( string | typeof INVALID ) [ ] = [ ]
380373 for ( let i = 0 ; i < chunkSize ; i ++ ) {
@@ -394,9 +387,6 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
394387 }
395388 }
396389
397- const colDuration = ( ( Date . now ( ) - colStart ) / 1000 ) . toFixed ( 2 )
398- logger . info ( ` ✓ [${ col . columnName } ] 완료 (${ colDuration } 초)` )
399-
400390 return { colIdx, values }
401391 } )
402392 )
@@ -408,17 +398,13 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
408398
409399 // === AI 컬럼 처리 (동시 MAX_AI_CONCURRENT개, 예외 처리 통일) ===
410400 if ( aiColumns . length > 0 ) {
411- logger . info ( `[${ tableName } ] AI 컬럼 처리 (동시 ${ MAX_AI_CONCURRENT } 개):` )
412-
413401 for ( let i = 0 ; i < aiColumns . length ; i += MAX_AI_CONCURRENT ) {
414402 const batch = aiColumns . slice ( i , i + MAX_AI_CONCURRENT )
415403
416404 const batchResults = await Promise . all (
417405 batch . map ( async ( colIdx ) => {
418406 const col = columns [ colIdx ]
419407 const stream = columnStreams [ colIdx ]
420- const colStart = Date . now ( )
421- logger . info ( ` ▶ [${ col . columnName } ] 처리 (${ col . dataSource } )` )
422408
423409 const values : ( string | typeof INVALID ) [ ] = [ ]
424410 for ( let j = 0 ; j < chunkSize ; j ++ ) {
@@ -438,9 +424,6 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
438424 }
439425 }
440426
441- const colDuration = ( ( Date . now ( ) - colStart ) / 1000 ) . toFixed ( 2 )
442- logger . info ( ` ✓ [${ col . columnName } ] 완료 (${ colDuration } 초)` )
443-
444427 return { colIdx, values }
445428 } )
446429 )
@@ -450,7 +433,6 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
450433 } )
451434
452435 if ( i + MAX_AI_CONCURRENT < aiColumns . length ) {
453- logger . info ( ` … 다음 AI 컬럼 대기 (1초)...` )
454436 await new Promise ( ( res ) => setTimeout ( res , 1000 ) )
455437 }
456438 }
@@ -529,47 +511,18 @@ async function runWorker(task: WorkerTask): Promise<WorkerResult> {
529511 totalProcessed += successOnThisChunk // 성공한 row만 증가
530512 totalFailed += failedOnThisChunk // fallback에서 실패한 row
531513
532- process . parentPort . postMessage ( {
533- type : 'row-delta' ,
534- tableName,
535- success : successOnThisChunk ,
536- fail : failedOnThisChunk
537- } )
538-
539514 await fs . promises . appendFile ( sqlPath , bulkSQL + '\n' , 'utf8' )
540515 }
541516
542- const chunkDuration = ( ( Date . now ( ) - chunkStartTime ) / 1000 ) . toFixed ( 2 )
543- logger . info ( `\n[${ tableName } ] 청크 ${ chunkIdx + 1 } 완료 (${ chunkDuration } 초)` )
544-
545- const progressPercent =
546- chunkIdx + 1 === numChunks ? 100 : Math . floor ( ( chunkEnd / recordCnt ) * 100 )
547-
548517 process . parentPort . postMessage ( {
549518 type : 'row-progress' ,
550519 tableName,
551- progress : progressPercent
520+ progress : chunkSize
552521 } )
553522
554523 await new Promise ( ( res ) => setTimeout ( res , 100 ) )
555-
556- if ( chunkEnd === recordCnt ) {
557- columns . forEach ( ( col ) => {
558- process . parentPort . postMessage ( {
559- type : 'column-progress' ,
560- tableName,
561- columnName : col . columnName ,
562- progress : 100
563- } )
564- } )
565- }
566524 }
567525
568- const totalDuration = ( ( Date . now ( ) - startTime ) / 1000 ) . toFixed ( 2 )
569- logger . info (
570- `\n[${ tableName } ] 전체 완료 (${ totalDuration } 초, ${ totalProcessed . toLocaleString ( ) } 행)`
571- )
572-
573526 if ( directContext ) {
574527 await directContext . commit ( )
575528 await directContext . close ( )
0 commit comments