chiark / gitweb /
routesearch: check for failure of routesearch and report XCPU specially
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 16:28:30 +0000 (17:28 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 16:28:30 +0000 (17:28 +0100)
yarrg/TODO
yarrg/web/query_routesearch

index ed81ded7ae4318a1ae59d6c71fdc244224445083..f8988df57d8f8a3354ce73e6c5359ef9666639b0 100644 (file)
@@ -1,7 +1,5 @@
 query_routesearch:
 
 query_routesearch:
 
-       Doesn't spot routesearch dying
-
        ap=A, ap=P turn into proper headings
        notes about leagues
 
        ap=A, ap=P turn into proper headings
        notes about leagues
 
index 8937f285e9f9c77e6f3a77585b5471b6bd3de44e..dc8c230c54767b3b5310004eed0d6b48c495d4db 100644 (file)
@@ -204,6 +204,26 @@ if ($qa->{'debug'}) {
        print "</pre>\n";
 }
 
        print "</pre>\n";
 }
 
+$!=0;
+if (!close $fh) {
+       die $! if $!;
+       die $? if $? != 24; # SIGXCPU but not in POSIX.pm :-/
+</%perl>
+<h2>Search took too long and was terminated</h2>
+
+Sorry, but your query resulted in a search that took too long.
+Searches are limited to <% $maxcpu |h %> seconds of CPU time to
+avoid them consuming excessive resources on the server system, and to
+make sure that shorter searches can still happen.
+
+<p>
+Please try a search with a smaller minimum distance, or place more
+restrictions on the route.
+
+<%perl>
+       return;
+}
+
 if ($concur_fail) {
 </%perl>
 <h2>Server too busy</h2>
 if ($concur_fail) {
 </%perl>
 <h2>Server too busy</h2>