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

Permanent reconnecting async session #324

Merged

Conversation

leszekhanusz
Copy link
Collaborator

@leszekhanusz leszekhanusz commented Apr 29, 2022

New interface to allow to create a permanent reconnecting session which can be kept in a class.

# Create a session from the client which will reconnect automatically.
# This session can be kept in a class for example to provide a way
# to execute GraphQL queries from many different places
session = await client.connect_async(reconnecting=True)

# You can run execute or subscribe method on this session
result = await session.execute(query)

# When you want the connection to close (for cleanup),
# you call close_async
await client.close_async()

Should fix #179

@codecov-commenter
Copy link

codecov-commenter commented Apr 29, 2022

Codecov Report

Merging #324 (2db7f5b) into master (6c91bb5) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #324   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         2159      2231   +72     
=========================================
+ Hits          2159      2231   +72     
Impacted Files Coverage Δ
gql/client.py 100.00% <100.00%> (ø)
gql/transport/aiohttp.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c91bb5...2db7f5b. Read the comment docs.

@leszekhanusz leszekhanusz merged commit 3970f1c into graphql-python:master Jul 3, 2022
@leszekhanusz leszekhanusz deleted the feature_permanent_session branch July 3, 2022 23:35
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.

Using a single session with FastAPI
2 participants