frank1 has asked for the wisdom of the Perl Monks concerning the following question:
Am having some problem with my script.
am calling it with cron job to run every some minutes
i recently received notice from my hosting that my script is causing problems to the server due to multiple requests per second
my question is that how can i loop using if statement because i have tested it and looks to be safe to use, because even using while loop it was skipping some condition if i say like
while (this eq to this) #then do this
it was skipping and just auto update to the database
working but sending mulitple requests per second on server and also sk +ipping some condition compering my $query = $dbh->prepare("SELECT plates FROM pintable WHERE status =? +"); $query->execute('OK'); while( my $row = $query->fetchrow_arrayref() ) { my $plates = $row->[0]; while ($STPU eq 'good') { # update DB with some data } $dbh->commit; } works great and not causing problems to server, but the problem it run +s single task per running my $query = $dbh->prepare("SELECT plates FROM pintable WHERE status =? +"); $query->execute('OK'); my $row = $query->fetchrow_arrayref(); my $plates = $row->[0]; if ($STPU eq 'good') { # update DB with some data } $dbh->commit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: looping safely
by Corion (Patriarch) on Aug 19, 2023 at 17:46 UTC | |
|