@@ -272,6 +272,7 @@ const fire = (req: IApiRequest) => {
272272 return map ( contentTypeUids , ( uid ) => {
273273
274274 return new Promise ( ( mapResolve , mapReject ) => {
275+ debug ( `API called with for content type: ${ uid } ` )
275276 return get ( {
276277 path : `${ Contentstack . apis . content_types } ${ uid } ` ,
277278 qs : {
@@ -290,12 +291,12 @@ const fire = (req: IApiRequest) => {
290291
291292 return mapResolve ( '' )
292293 }
293- const err : any = new Error ( ' Content type ${uid} schema not found!' )
294+ const err : any = new Error ( ` Content type ${ uid } schema not found!` )
294295 // Illegal content type call
295296 err . code = 'ICTC'
296-
297297 return mapReject ( err )
298298 } ) . catch ( ( error ) => {
299+ debug ( 'Error [map] fetching content type schema:' , error )
299300 if ( netConnectivityIssues ( error ) ) {
300301 flag . SQ = false
301302 }
@@ -312,16 +313,18 @@ const fire = (req: IApiRequest) => {
312313 flag . SQ = false
313314 }
314315 // Errorred while fetching content type schema
315-
316+ debug ( 'Error [mapResolve]:' , error )
316317 return reject ( error )
317318 } )
318319 } ) . catch ( ( processError ) => {
320+ debug ( 'Error [filterItems]:' , processError )
319321 return reject ( processError )
320322 } )
321323 }
322324
323325 return postProcess ( req , syncResponse )
324326 . then ( resolve )
327+ . catch ( reject )
325328 } ) . catch ( ( error ) => {
326329 debug ( 'Error [fire]' , error ) ;
327330 if ( netConnectivityIssues ( error ) ) {
@@ -368,9 +371,13 @@ const postProcess = (req, resp) => {
368371 return resolve ( '' )
369372 }
370373
374+ debug ( `Re-Fire called with: ${ JSON . stringify ( req ) } ` )
375+ // Add a small delay before re-firing to prevent recursive overload
376+ setTimeout ( ( ) => {
371377 return fire ( req )
372378 . then ( resolve )
373- . catch ( reject )
379+ . catch ( reject ) ;
380+ } , 1000 ) ; // Add 1 second delay before re-firing
374381 }
375382 } )
376383 . catch ( reject )
0 commit comments