chiark / gitweb /
routesearch: fix up web performance parameterisation
[ypp-sc-tools.db-test.git] / yarrg / web / query_routesearch
index 6f051351ca2f981bf677f2bd2fa4394f78a81459..b6d543fae1c7c122c72485a36c5bf30146f4505b 100644 (file)
@@ -52,11 +52,13 @@ my $emsg;
 my @warningfs;
 my @islandids;
 
+my $maxmaxdist=35;
+my $maxcpu=90;
+
 my $qa= \%ARGS;
 my $routeparams= { EmsgRef => \$emsg, SayRequiredCapacity => 1 };
 my $maxdist;
 my $maxcountea=10;
-my $maxcpu=10;
 
 </%perl>
 
@@ -95,8 +97,8 @@ This feature is not available from the "drop down menus" interface.
 </form>
 <%perl>
 
-if (!$emsg && $maxdist > 30) {
-       $emsg= "Searching for routes of more than 30 leagues is not".
+if (!$emsg && $maxdist > $maxmaxdist) {
+       $emsg= "Searching for routes of more than $maxmaxdist leagues is not".
                " supported, sorry.";
 }
 
@@ -131,6 +133,7 @@ foreach my $k (qw(MaxMass MaxVolume MaxCapital)) {
 }
 push @rsargs, defined $routeparams->{LossPerLeaguePct}
        ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9;
+push @rsargs, '0';
 push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea, 'any', @islandids;
 
 m/[^-.0-9a-zA-Z]/ and die "$_ $& ?" foreach @rsargs;
@@ -151,7 +154,7 @@ my $child= $fh->open("-|"); defined $child or die $!;
 if (!$child) {
        my $cpu= BSD::Resource::RLIMIT_CPU;
        my ($soft,$hard)= getrlimit($cpu);
-       setrlimit($cpu,$maxcpu,$hard) or die $! if $soft>$maxcpu;
+       setrlimit($cpu,$maxcpu,$hard) or die $! if $hard<=$maxcpu;
        exec @rsargs;
        die $!;
 }