Skip to content

Commit

Permalink
MBS-12589: Return if direct search query times out
Browse files Browse the repository at this point in the history
Return early if an existing Internal Server Error occurs within the
direct/external search methods, instead of attempting to render the
results page with an undef pager, triggering another error.

This also ensures a "Request Timed Out" page is shown to the user
instead of "Internal Server Error" in cases where a statement timeout
occurs, since it doesn't get confused by multiple errors in `$c->error`.
  • Loading branch information
mwiencek committed Sep 12, 2022
1 parent 67a5f05 commit 5378a98
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/MusicBrainz/Server/Controller/Search.pm
Expand Up @@ -61,6 +61,10 @@ sub search : Path('')
$c->forward($form->field('method')->value eq 'direct' ? 'direct' : 'external');
}

# $c->error may be set if an Internal Server Error occurs within the
# direct/external search methods, e.g. a database query timeout.
return if $c->error;

if ($type ne 'doc') {
my $stash = $c->stash;

Expand Down

0 comments on commit 5378a98

Please sign in to comment.