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

FIX: callback endpoint hook #58

Merged
merged 7 commits into from
Sep 11, 2023
Merged

Conversation

TauannyFurlanetto
Copy link
Contributor

@TauannyFurlanetto TauannyFurlanetto commented Sep 8, 2023

what

Fixes the TypeError error while using the add_callback_endpoint to BarterDude

Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/app/elasticsearch_indexer_worker/__main__.py", line 8, in <module>
    app = Consumer()
  File "/app/elasticsearch_indexer_worker/consumer.py", line 94, in __init__
    (datalake_publisher_mock(), "datalake_publisher")
  File "/usr/local/lib/python3.7/site-packages/barterdude/__init__.py", line 53, in add_callback_endpoint
    hook=hook_to_callback
  File "/usr/local/lib/python3.7/site-packages/barterdude/__init__.py", line 39, in add_endpoint
    )(hook)
  File "/usr/local/lib/python3.7/site-packages/asyncworker/app.py", line 140, in wrapper
    f"handler must be a coroutine: {handler}"
TypeError: handler must be a coroutine: <method-wrapper '__call__' of function object at 0x400c8db830>

Also fixes the typing error caused by type checking the hook_to_callback function and the error caused by not awaiting the _call_callback_endpoint coroutine

why

Without this is fix, we can't run apps with callback hooks

how

Makes the hook_to_callback function a couroutine, adds a typing to the hook_to_callback args and awaits for the _call_callback_endpoint func

@TauannyFurlanetto TauannyFurlanetto changed the title FIX: callback hook should be async FIX: callback endpoint hook Sep 8, 2023
@TauannyFurlanetto TauannyFurlanetto marked this pull request as ready for review September 8, 2023 18:44
@TauannyFurlanetto TauannyFurlanetto requested a review from a team September 8, 2023 18:52
@TauannyFurlanetto TauannyFurlanetto merged commit 6501dbd into master Sep 11, 2023
@TauannyFurlanetto TauannyFurlanetto deleted the fix/callback-endpoint-hook branch September 11, 2023 13:09
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.

2 participants