Frappe.db.insert async


I’m writing a custom code (client) and running a loop to collect data, inside the loop I am running a frappe.db.insert() call. The issue I am facing, is that the loop completes before the insert runs. As in, the insert function is threaded and while it’s running, the loop completes before it. Is there a way I can make the code wait for the frappe.db.insert to complete before continuing on?

Hi, you can use the time.sleep(x) in the code.

for ... :
    while downloading_not_finished:

@mangroliya , my issue is with Javascript and this seems to be python? Please let me know how can this be done in JS. thanks!

Could u copy and paste ur code for better understanding