Check async function instances [duplicate]

right now I have a recursive async function without awaits when it calls itself with Javascript, and it is using API calls, so it take some time to finish running.

This would be an example of that function:

var myFunction = async function(node){
    // takes some time with the API call and we wait
    var info = await getInfoFromAPI(node.uniqueId);

    // includes part of the info in a global tree variable

    // Will stop when there are no more nodes to process
    for(let i = 0; i < info.arrayOfNewNodes; i++){
        
        // All this calls would be without the await, to avoid processing time
        myFunction(info.arrayOfNewNodes[i]);
    }
}

The idea is that the user can fill stuff in forms while this loads, because it normally takes 2 minutes or something like this. Adding an await to the recursive call will increase the time to 15 minutes.

I need to check when there are no instances of that function to proceed with other logic, or in other words, I need to know when the functions finished their work.

Is there a way to check if there are instances of the function still running?