Gentlepersons - I surrounded db change code with a timeout, hoping that if there was a problem with the DB I/O, and it hung, the timeout would free up the program and allow it to continue. However, it does not seem to be working, and the program is hanging up. This is on a Windows 10 server. Did I miswrite the timeout, or is there an issue with Windows, or something else ?
my $sth; my $res; eval{ local $SIG{ALRM} = sub { die "db_timeout" }; alarm 12; $sth = $dbh->prepare($sql); if (! defined $sth) { print LOG "ERROR: insert prepare failed\n"; } else { $res = $sth->execute; } alarm 0; }; if ($@) { if ($@ !~ /db_timeout/) { print LOG "ERROR: Alarm during insert execute othe +r than db_timeout: $@\n"; } else { print LOG "ERROR: db_timeout: $@\n"; } }
In reply to Timeout Failing by beckmanel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |