Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #2597 (Handle RSolr timeouts with its own class) #2636

Merged
merged 6 commits into from
Feb 25, 2022

Conversation

cbeer
Copy link
Member

@cbeer cbeer commented Feb 25, 2022

No description provided.

jrochkind and others added 6 commits February 25, 2022 07:07
…class

== context ==

Almost any RSolr exception is wrapped by Blacklight in a `Blacklight::Exceptions::InvalidRequest`

A Blacklight Catalog controller [rescues](https://github.com/projectblacklight/blacklight/blob/main/app/controllers/concerns/blacklight/catalog.rb#L21) this exception with a [method](https://github.com/projectblacklight/blacklight/blob/main/app/controllers/concerns/blacklight/catalog.rb#L282-L299) that just re-displays the search page, with the message "Sorry, I don't understand your search."

"Connection refused" errors are handled differently -- which is good, it would make no sense to prompt the user to search again with "Sorry, I don't understand your search" to network errors like connection refused.

What about a timeout error, where Solr did not return in a response within the timeout value RSolr had configured?  Prior to this PR, that was handled the same as any `Blacklight::Exceptions::InvalidRequest` -- redisplay search page to the user, with message "Sorry, I don't understand your search."

That is not a desirable UX, and also causes Solr timeout errors to generally not make it to many error monitoring and logging systems, since Blacklight rescues them and displays a 200.

== change ==

With the release of RSolr 2.4.0, RSolr uses a specific exception class to raise timeout errors, so Blacklight can rescue them and handle them differently.

After this PR, they are handled analogously to connection refused errors, with a custom exception that won't be rescued as a `Blacklight::Exceptions::InvalidRequest`.

a `defined?` check is done so Blacklight can still work with earlier versions of RSolr, and just won't do this new rescue.

== weird code in test ==

RSolr::Error api has some really rough edges, which requires some weirdness in setting up the test.

== to be done in future ==

I formatted the message of this exception just like the existing `Blacklight::Exceptions::ECONNREFUSED`... even though that formatting isn't necessarily so useful, there's a lot of stuff in there.

But I opted to do it consistently.
… method

Thanks @barmintor, I think you're right this is more clear.
@jcoyne jcoyne merged commit c81ae16 into release-7.x Feb 25, 2022
@jcoyne jcoyne deleted the backport-2597 branch February 25, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants