dealing with lengthy (time) query sets
- From: woodshop2300@xxxxxxxxx (WoodShop)
- Date: Sat, 07 Apr 2007 03:02:57 -0400
I currently have script/program that simply takes input lines and does work on them.
updating tables accordingly and all is good.
however every 'x' input lines i need to call a subroutine that does some work on the database that takes a while, like 1 or 2 min. however i can't have the program become unresponsive for that long.
My original idea was to spawn a thread off the subroutine and then it could go do all the work it likes leaving the main section to continue on chugging through input. However when I tried this i got errors about
"""handle 3 is owned by thread 61f010 not current thread 11deb70 (handles can't be shared between threads and your driver may need a CLONE method added) """
So i gave up on that and figured i do it with fork, however there are apparently issues with keeping the database connection associated with that.
My last resort which i know works is to make another script that makes its own database connection does its work and dies. I would run this script when i need to by making exec "..." calls and passing my parameters via the command line args. I'v done this before and i know it works, but it just seems ugly and hacked together and i can't help but think there must be a better way, i can't be the only person that has to deal with situations like this..
--
------------------------------------
Alex Anagnos
Student: Northern Michigan University
woodshop2300@xxxxxxxxx
------------------------------------
.
- Follow-Ups:
- RE: dealing with lengthy (time) query sets
- From: Philip Garrett
- RE: dealing with lengthy (time) query sets
- From: Ron Reidy
- RE: dealing with lengthy (time) query sets
- Prev by Date: Re: Just when is $dbh->commit() needed?
- Next by Date: RE: dealing with lengthy (time) query sets
- Previous by thread: Just when is $dbh->commit() needed?
- Next by thread: RE: dealing with lengthy (time) query sets
- Index(es):
Relevant Pages
|