our $irspy_to_zeerex_xsl = dirname(__FILE__) . '/../../xsl/irspy2zeerex.xsl';
our $debug = 0;
our $xslt_max_depth = 250;
+our $max_timeout_errors = 3;
# Enumeration for callback functions to return
my $timeout = $this->{timeout};
$this->log("irspy", "beginnning with test '$topname' (timeout $timeout)");
+ $timeout = 2;
+
my $nskipped = 0;
my @conn = @{ $this->{connections} };
while (1) {
my @copy_conn = @conn; # avoid alias problems after splice()
my $nconn = scalar(@copy_conn);
+
+
foreach my $i0 (0 .. $#copy_conn) {
my $conn = $copy_conn[$i0];
+ #warn Dumper($conn);
+
#print "connection $i0 of $nconn/", scalar(@conn), " is $conn\n";
next if !defined $conn;
if (!$conn->current_task()) {
$conn->log("irspy_test",
"checking for next test after '$address'");
$nextaddr = $this->_next_test($address);
+ if ($nextaddr && $conn->record->zoom_error->{TIMEOUT} >= $max_timeout_errors) {
+ $conn->log("irspy", "Got to many timeouts, stop testing: " . $conn->record->zoom_error->{TIMEOUT});
+ $nextaddr = "";
+ }
}
if (!defined $nextaddr) {
$conn->log("irspy", "has no more tests: removing");
target => $target,
parser => $parser,
zeerex => $parser->parse_string($zeerex)->documentElement(),
+ zoom_error => { TIMEOUT => 0 },
}, $class;
#Scalar::Util::weaken($this->{irspy});
return $this;
}
+sub zoom_error { return shift->{'zoom_error'} }
sub _empty_zeerex_record {
my($target) = @_;
use ZOOM::IRSpy::Test;
our @ISA = qw(ZOOM::IRSpy::Test);
+our $max_timeout_errors = $ZOOM::IRSpy::max_timeout_errors;
# These queries
my @queries = (
$conn->log("irspy_test", "Fetch test search (", $task->render_query(), ") ",
ref $event && $event->isa("ZOOM::Exception") ?
"failed: $event" : "found $n records (event=$event)");
+
+ # remember how often a target record hit a timeout
+ if (ref $event && $event->isa("ZOOM::Exception")) {
+ if ($event =~ /Timeout/i) {
+ $conn->record->zoom_error->{TIMEOUT}++;
+ $conn->log("irspy_test", "Increase timeout error counter to: " .
+ $conn->record->zoom_error->{TIMEOUT});
+ }
+ }
+
if ($n == 0) {
$task->{rs}->destroy();
my $qindex = $udata->{queryindex}+1;
return ZOOM::IRSpy::Status::TEST_SKIPPED
if !defined $q;
- $conn->log("irspy_test", "Trying another search ...");
- $conn->irspy_search_pqf($queries[$qindex], { queryindex => $qindex }, {},
+ if ($conn->record->zoom_error->{TIMEOUT} >= $max_timeout_errors) {
+ $conn->log("irspy_test", "Got $max_timeout_errors timeouts, give up...");
+ } else {
+ $conn->log("irspy_test", "Trying another search ...");
+ $conn->irspy_search_pqf($queries[$qindex], { queryindex => $qindex }, {},
ZOOM::Event::ZEND, \&completed_search,
exception => \&completed_search);
+ }
return ZOOM::IRSpy::Status::TASK_DONE;
}