#!/usr/bin/perl -w
-# $Id: stress-test,v 1.1 2007-01-02 13:30:52 sondberg Exp $
+# $Id: stress-test,v 1.2 2007-01-02 14:11:02 sondberg Exp $
# -------------------------------------------------
# Simulate a search/retrieve session
my $parser = new XML::LibXML;
my $ua = new LWP::UserAgent;
my $session_id = get_session($ua);
-my $debug = 1;
+my $debug = 0;
my @terms = qw(water mineral computer java texas energy xml pirsig clinton
management environment dinosaur houston washington);
if (start_search($session_id, $ua, $term)) {
print STDERR "Success...\n";
- foreach (1..10) {
- sleep(1);
-
- if (fetch_records($session_id, $ua)) {
- print STDERR "Fetched...\n";
+ foreach my $p (0..4) {
+ foreach (1..10) {
+ sleep(1);
+
+ if (fetch_records($session_id, $ua, $p * 20)) {
+ print STDERR "Fetched...\n";
+ }
}
}
}
sub fetch_records {
- my ($sid, $ua) = @_;
- my $uri = $url . '?session=' . $sid . '&command=show';
+ my ($sid, $ua, $offset) = @_;
+ my $uri = $url . '?session=' . $sid . '&command=show&start=' . $offset;
my $response = $ua->get($uri);
if ($response->is_success) {