Threads CGI & database connections...

C

Chris Lyon

We run a sound effects library site.

I use a cgi script written in python to copy files from our file
repository to a publically viewable directory for clients to pick up
with locations sent to them in E-mails and on a completion web page.
Unfortunately since some of the files are fairly large (20-30 Mbytes
is not untypical) it can take a considerable length of time to copy
the files across.
So we would like to implement something that would allow us to quickly
report back that the process has been started and then copy the files
across whilst a small piece of javascript will refresh the viewing
page to indicate the progress.

The status page extracts it's information from the database where a
progress column is populated ( 1 to indicate copy started and 2 to
indicate copy completed).

Now this seems to mean threads( it's all hosted on windows2000 ) an
area I have little ( read none) experience of. I believe I will have
to maintain a database cursor within the active thread to indicate the
progress to the database.

Also I am confused by the need to reply quickly to the initial
request and yet maintain the copying processes going for some
considerable time in the 'background'. Do I have to spawn a thread to
reply to the initial request and then spawn other threads to do the
copying? What could happen if parts of the process doesn't complete,
and how do I manage lots of database connections in this arrangement ?
If I want to run multiple copy programmes will I have to give each one
a database connection or can I use a mechanism like queue to resolve
all this?

I'm sorry to post such a broad question, I have been reading as much
as I can on these sorts of issues but I hope that someone will be able
to shed some light before I end up doing much more research and
protyping on routes that are already known to be suspect, unreliable
or down right flaky.

So to paraphrase:-

I wish to make a call to a webpage with a post variable containing a
transaction identifier, which will reply with the transaction details
of the sounds chosen, and also set in motion the copy process.
The successful return from the initial call will display a seperate
status page that will display a list of all the files that have copied
up to that point. This page will be polled by a javascript script to
review every 60 seconds until completion.

Yours in anticipation

Chris Lyon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top