I have built a user import page that imports via csv file upload. The issue I am having is that the page is loading before all of the rows (user information) is finished processing/ inserting users. It works fine if there is 1 or 2 users/ rows in csv but beyond that it does not complete the job.
Is there a way to delay the page load until the process of importing the users from the csv file is completed?
The use case goes like this. A user goes to the import page, browses files (csv) then clicks submit. After clicking the submit, a function kicks off that processes each row in the csv and imports user into wordpress. The csv file could have hundreds of rows or just a handful. The page will keep loading until the process is complete. Once complete the page loads and has an output(log) of all of the users that were imported.
The part that I am stuck on is giving enough time for the process to finish before the page is loaded.