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

Skip full text search if failed #9654

Merged
merged 2 commits into from Dec 30, 2018

Conversation

Projects
None yet
2 participants
@Kjwon15
Copy link
Contributor

Kjwon15 commented Dec 29, 2018

Sometimes, ES server are dead while main server is live.
We should give general search results(accounts, hashtags) even if ES server is dead.

results[:hashtags] = perform_hashtags_search! if hashtag_searchable?
begin
results[:statuses] = perform_statuses_search! if full_text_searchable?
rescue Faraday::ConnectionFailed

This comment has been minimized.

@Gargron

Gargron Dec 29, 2018

Member

I think it would be more elegant to just add a rescue block to the perform_statuses_search! method

@@ -62,7 +62,12 @@ def url_resource_symbol

def full_text_searchable?

This comment has been minimized.

@Gargron

Gargron Dec 29, 2018

Member

That's not the right method. Also, def/end blocks can have a rescue clause without extra begin/end.

This comment has been minimized.

@Kjwon15

Kjwon15 Dec 29, 2018

Author Contributor

like this?

def method
  do_something
rescue Exception
  fallback
end

This comment has been minimized.

@Gargron

Gargron Dec 29, 2018

Member

Yes, like that. 👍

@Kjwon15 Kjwon15 force-pushed the Kjwon15:fallback-chewy branch 2 times, most recently from c4c17a6 to 4dcd5f8 Dec 29, 2018

@Kjwon15 Kjwon15 force-pushed the Kjwon15:fallback-chewy branch from 4dcd5f8 to 120276a Dec 29, 2018

@Gargron Gargron merged commit 511231c into tootsuite:master Dec 30, 2018

11 checks passed

ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: check-i18n Your tests passed on CircleCI!
Details
ci/circleci: install Your tests passed on CircleCI!
Details
ci/circleci: install-ruby2.3 Your tests passed on CircleCI!
Details
ci/circleci: install-ruby2.4 Your tests passed on CircleCI!
Details
ci/circleci: install-ruby2.5 Your tests passed on CircleCI!
Details
ci/circleci: test-ruby2.3 Your tests passed on CircleCI!
Details
ci/circleci: test-ruby2.4 Your tests passed on CircleCI!
Details
ci/circleci: test-ruby2.5 Your tests passed on CircleCI!
Details
ci/circleci: test-webui Your tests passed on CircleCI!
Details
codeclimate All good!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment