Welcome Guest, Not a member yet? Register   Sign In
progress bar for long running script
#1

[eluser]BlueCamel[/eluser]
I'm building a site that will have a long running process and want to give the user feedback as to the status. The process operates on a file uploaded or selected off a remote server. The file in question could be between 300 and 600 MB and I need to process each line and update a mysql db as appropriate. I've got this working by doing the following

1) first page shows an upload/file select
2) if the upload or file read is successful, show the /view/success.php page
3) on /view/success.php, use AJAX (jquery) to run two processes:

a) call /file/parser controller to process the file uploaded or selected
b) call /file/progress controller to monitor the process of the /file/parser script
c) when /file/parser completes, load a /view/file page for processing results.

I communicate by simply having /file/parser write a percentage complete into a mysql tmp table and /file/progress monitor it and update the progress bar on the page view.

Yes, it really all works. But is it sane? How would you go about monitoring the progress on a script that could run for 120 to 200 seconds before showing final results?




Theme © iAndrew 2016 - Forum software by © MyBB