Deadlock Occurred, when insert record to doctype

Hello Guys, i hace case not finished. I hope someone can help

I have doctype name : ABC_QA_DMS_MASTER_DATA, and i have data from API external, let say the data like this.

let docs = [{“description”:“test1”,“doctype”:“ToDo”},{“description”:“test2”,“doctype”:“ABC_QA_DMS_MASTER_DATA”},{“description”:“test3”,“doctype”:“ABC_QA_DMS_MASTER_DATA”}];

            const funcs = dataArray.map((doc) => {
              frappe.call({
                method: "frappe.client.insert",
                args: {
                  doc: doc // doc object
                },
                callback: function(r) {
                  //callback script
                }
              });  
            });
            
            Promise.all(funcs).then(()=> {
              console.log("Done");
            });

i have been try like that script that i found on this forum, but showing like this

and i have create one, like this below, same got error

            dataArray.map(function(element){
              console.log("elemetn", element);
                  frappe.db.insert({
                    doctype: "ABC_QA_DMS_MASTER_DATA",
                    description: element.item,

                }).then(doc => {
                    frappe.db.commit();
                });                
            }); 

Data is 45 row,. Is my script wrong or where am I missing?

Hello Guys, i have been try like this and work

            for (let i = 0; i < paramData.data.length; i++) {

                setTimeout(function(){
                    
                    if(i != paramData.data.length){
                        frappe.db.insert({
                          doctype: "ABC_QA_DMS_MASTER_DATA",
                          description: paramData.data[i].description
                        })                        
                    }
                    
                    if(i == (parseInt(paramData.data.length) - 1)){
                        removeLoadingFromDiv();
                    }
            
                },i * 1000)                
            }

if there is a better one, please let me know. Thankyou