@@ -5,7 +5,7 @@ import { v4 as uuidv4 } from "uuid";
55import _ from "lodash" ;
66import axios from "axios" ;
77import jsonpath from "jsonpath" ;
8- // import pLimit from 'p-limit';
8+ import pLimit from 'p-limit' ;
99
1010
1111import { CHUNK_SIZE , MIGRATION_DATA_CONFIG } from "../constants/index.js" ;
@@ -408,24 +408,17 @@ const createAssets = async (packagePath: any, destination_stack_id:string, proje
408408 const assets = JSON . parse ( data ) ?. assets ;
409409
410410 if ( assets && assets . length > 0 ) {
411- const tasks = assets . map (
412- async ( asset : any , index : any ) =>
413- saveAsset ( asset , failedJSON , assetData , metadata , projectId , destination_stack_id , 0 )
411+ const limit = pLimit ( 10 ) ; // Limit concurrent operations to 10
412+ const tasks = assets . map ( ( asset : any ) =>
413+ limit ( ( ) => saveAsset ( asset , failedJSON , assetData , metadata , projectId , destination_stack_id , 0 ) )
414414 ) ;
415415
416- // This code is intentionally commented out
417- // for testing purposes.
418-
419- // const limit = pLimit(10); // Limit concurrent operations to 10
420- // const tasks = assets.map((asset: any) =>
421- // limit(() => saveAsset(asset, failedJSON, assetData, metadata, projectId, destination_stack_id, 0))
422- // );
423- // await Promise.all(tasks);
424-
425416 await Promise . all ( tasks ) ;
426417 const assetMasterFolderPath = path . join ( assetsSave , ASSETS_FAILED_FILE ) ;
427418
428419 await writeOneFile ( path . join ( assetsSave , ASSETS_SCHEMA_FILE ) , assetData ) ;
420+ // This code is intentionally commented out
421+
429422 // const chunks: { [key: string]: any } = makeChunks(assetData);
430423 // const refs: any = {};
431424
@@ -653,12 +646,6 @@ const createEntry = async (packagePath: any, destination_stack_id:string, projec
653646 entryData [ name ] [ locale ] [ id ] [ formattedKey ] = value ;
654647 }
655648 ) ;
656- const message = getLogMessage (
657- srcFunc ,
658- `Entry title "${ entryData [ name ] [ locale ] [ id ] ?. title } "(${ name } ) in the ${ locale } locale has been successfully transformed.` ,
659- { }
660- )
661- customLogger ( projectId , destination_stack_id , 'info' , message )
662649 } ) ;
663650 } ) ;
664651
@@ -673,6 +660,14 @@ const createEntry = async (packagePath: any, destination_stack_id:string, projec
673660 values as { [ key : string ] : any }
674661 ) ) {
675662 const chunks = await makeChunks ( localeValues ) ;
663+ for ( const [ entryKey , entryValue ] of Object . entries ( localeValues ) ) {
664+ const message = getLogMessage (
665+ srcFunc ,
666+ `Entry title "${ ( entryValue as { title : string } ) ?. title } "(${ key } ) in the ${ localeKey } locale has been successfully transformed.` ,
667+ { }
668+ ) ;
669+ await customLogger ( projectId , destination_stack_id , "info" , message ) ;
670+ }
676671 const refs : { [ key : string ] : any } = { } ;
677672 let chunkIndex = 1 ;
678673 const filePath = path . join (
0 commit comments