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

Healthcheck does not work in synchronous context #6

Closed
nickodell opened this issue Jan 27, 2023 · 3 comments
Closed

Healthcheck does not work in synchronous context #6

nickodell opened this issue Jan 27, 2023 · 3 comments

Comments

@nickodell
Copy link
Contributor

  • HealthChecks Context Manager version: v0.1.5
  • Python version: Python 3.8.13
  • Operating System: OSX 13.1

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

I used the example code, with the sync version.

What I Did

from healthchecks_wrapper import HealthCheck
valid_ping_url = "https://hc-ping.com/5ee5d9a3-eef0-40d5-88ad-7f092f40875b"  # Replace with your job url

# Sync jobs
with HealthCheck(valid_ping_url):
    # Do your job
    print("hi")

I got this error:

test10.py:6: RuntimeWarning: coroutine 'HealthCheck.send_request' was never awaited
  with HealthCheck(valid_ping_url):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
hi
/Users/nick/.pyenv/versions/3.8.13/lib/python3.8/site-packages/healthchecks_wrapper/context_manager.py:36: RuntimeWarning: coroutine 'HealthCheck.send_request' was never awaited
  self.send_request(JOB_END_POST_FIX)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

This code works in 0.1.4, though.

@samarpan-rai
Copy link
Owner

Thank you reporting this. The test should have caught this. I'll look into it.

@samarpan-rai
Copy link
Owner

samarpan-rai commented Jan 27, 2023

Version 0.1.6 should have fixed it. Thank you again for reporting it!

@nickodell
Copy link
Contributor Author

Thanks!

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

No branches or pull requests

2 participants