-
Notifications
You must be signed in to change notification settings - Fork 90
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
Conversation
2314cda
to
f70a8f7
Compare
f70a8f7
to
5ac8229
Compare
There was a problem hiding this 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 theMeiliSearchApiError
. But I don't think this is enough. Most of the time, when the server is not reachable, you will get another error, likeCommunicationError
(cfmeilisearch-python/meilisearch/errors.py
Lines 29 to 33 in 6cf5166
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!
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
A small change
Co-authored-by: Clémentine Urquizar <[email protected]>
There was a problem hiding this 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 :)
884d665
to
775d86b
Compare
bors merge |
Checking that method health() return
{'status': 'available'}
and added isHealthy() method who return boolean valuemeilisearch/integration-guides#55