Planned failure is now at the end of the search handler, not the beginning.
authorMike Taylor <mike@indexdata.com>
Thu, 8 Mar 2007 14:51:32 +0000 (14:51 +0000)
committerMike Taylor <mike@indexdata.com>
Thu, 8 Mar 2007 14:51:32 +0000 (14:51 +0000)
(This gives more informative logging.)

ztest.pl

index c5bec85..ea330b0 100755 (executable)
--- a/ztest.pl
+++ b/ztest.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-##  $Id: ztest.pl,v 1.16 2007-03-07 11:25:29 mike Exp $
+##  $Id: ztest.pl,v 1.17 2007-03-08 14:51:32 mike Exp $
 ##  ------------------------------------------------------------------
 ##
 ##  Copyright (c) 2000-2004, Index Data.
@@ -106,10 +106,6 @@ my $_counter = 0;
 sub my_search_handler { 
        my $args = shift;
 
-       if ($_fail_frequency != 0 && ++$_counter % $_fail_frequency == 0) {
-           print "Exiting to be nasty to client\n";
-           exit(1);
-       }
        my $data = [{
                        name            =>      "Peter Dornan",
                        title           =>      "Spokesman",
@@ -139,6 +135,10 @@ sub my_search_handler {
        $args->{HITS} = $hits;
        $session->{$set_id} = $data;
        $session->{__HITS} = $hits;
+       if ($_fail_frequency != 0 && ++$_counter % $_fail_frequency == 0) {
+           print "Exiting to be nasty to client\n";
+           exit(1);
+       }
 }