In the following code InsertIntoDB is a recursive function. Problem is after one one call to InsertIntoDB it executes mainFn. I want to execute mainFn after InsertIntoDB is completely over.
This is my code:
async.series([
    function(callback) {
        insertIntoDB(obj);
        callback();
    },
    function(callback) {
        mainFn();
        callback();
    }
]);
 
    