The stupid question is the question not asked | |
PerlMonks |
Append to a busy flat-file db without leaving customer in lurchby davebaker (Pilgrim) |
on Jan 22, 2006 at 21:33 UTC ( [id://524840]=perlquestion: print w/replies, xml ) | Need Help?? |
davebaker has asked for the wisdom of the Perl Monks concerning the following question:
Hello, monks! I have built much of my living around the help wanted ads on my web site. Hence it is important that an incoming help wanted ad actually get recorded into the flat-file database I'm using.
Most of the time life is good. Alas, sometimes the database seems to be too busy to allow the incoming data to be written, meaning the web server times out after the employer/customer has clicked the "submit" button. Clicking the submit button basically runs this code in a Perl script:
I'm wondering if anybody can suggest improvements. When the flock fails and the script dies, currently the customer just sees a blank screen. I can modify the script to spit out some HTML to notify the customer that the site is too busy, but that's not too much improvement in terms of getting money on the table. Does anybody use a loop after such a flock fails initially, to try a second or third time and notify the customer that the order is still being processed? Perhaps the only answer is to go to a relational DB? I have tried to get the database "out of the way" on the read side, by having the other script (which reads and displays the content of particular ads) open the database, slurp all the lines into @lines, and then close the database "right away," rather than having a big loop in the fashion of "while my $line=<$file_handle> {" Ya think that makes a difference in preventing flock failures on the write-side? Many thanks!
Back to
Seekers of Perl Wisdom
|
|