Skip to content

Standardize health method #246

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

Merged
merged 1 commit into from
Apr 15, 2021

Conversation

alallema
Copy link
Contributor

@alallema alallema commented Apr 13, 2021

Checking that method health() return {'status': 'available'} and added isHealthy() method who return boolean value

meilisearch/integration-guides#55

@alallema alallema force-pushed the fix-standardize_health_method branch from 2314cda to f70a8f7 Compare April 13, 2021 13:16
@curquiza curquiza requested review from curquiza and bidoubiwa April 13, 2021 13:24
@alallema alallema force-pushed the fix-standardize_health_method branch from f70a8f7 to 5ac8229 Compare April 13, 2021 13:40
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR @alallema!

Some points:

  • for is_healthy I see you only catch the MeiliSearchApiError. But I don't think this is enough. Most of the time, when the server is not reachable, you will get another error, like CommunicationError (cf
    class MeiliSearchCommunicationError(MeiliSearchError):
    """Error when connecting to MeiliSearch"""
    def __str__(self):
    return f'MeiliSearchCommunicationError, {self.message}'
    ).
  • for the health() method, you just need to let the error being raised so, no need to catch it to raise it . Just call the route! 🙂

However I just realize the issue I opened in integration guide was done before the change applied on the /health route, so it's not accurate anymore. Should the health() method return true or the body of the health method (status: available)? I'm going to update the issue!

Copy link
Contributor Author

@alallema alallema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@curquiza you right:

for is_healthy I just check the __validate method and not the send_request, so I think the MeiliSearchTimeoutError is required too. Sorry for forgetting.
for health method I change for a return like it was!

@alallema alallema requested a review from curquiza April 13, 2021 16:13
@alallema alallema requested a review from curquiza April 13, 2021 16:50
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
A small change

@alallema alallema requested a review from curquiza April 14, 2021 14:55
curquiza
curquiza previously approved these changes Apr 14, 2021
Co-authored-by: Clémentine Urquizar <[email protected]>
bidoubiwa
bidoubiwa previously approved these changes Apr 14, 2021
Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 LGTM ! Thanks for this PR :)

@bidoubiwa
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Apr 15, 2021

@bors bors bot merged commit fdd55d9 into meilisearch:main Apr 15, 2021
@alallema alallema deleted the fix-standardize_health_method branch April 15, 2021 10:57
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.

4 participants