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

Extension: Use context managers for lifecycle hooks #1864

Closed
1 of 3 tasks
ThirVondukr opened this issue May 2, 2022 · 0 comments · Fixed by #2428
Closed
1 of 3 tasks

Extension: Use context managers for lifecycle hooks #1864

ThirVondukr opened this issue May 2, 2022 · 0 comments · Fixed by #2428
Milestone

Comments

@ThirVondukr
Copy link
Contributor

Feature Request Type

  • Core functionality
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

Introduce a new interface for extension hooks - on request/validation/parsing/execution using context managers instead of on start/end hooks:

def on_request(self) -> Iterable[None]:
    #  This part is called when a GraphQL request starts
    yield
    # This part is called when a GraphQL request ends

This makes it easier to manage resources (e.g. open connections) and share data between start/end hooks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants