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

chore: Add a context manager to DflyInstance so we don't forget to close them. #1873

Merged
merged 2 commits into from Sep 18, 2023

Conversation

royjacobson
Copy link
Contributor

Also removes some annoying boilerplate.

dranikpg
dranikpg previously approved these changes Sep 18, 2023
Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, but sadly in Python it adds one more step of identation

@romange
Copy link
Collaborator

romange commented Sep 18, 2023

Great, but sadly in Python it adds one more step of identation

We can also use multiple with definitions on a single line:

    async with async_resource("A") as res1, async_resource("B") as res2:
        print(f"Using resources {res1} and {res2}")

Co-authored-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roy Jacobson <roi.jacobson1@gmail.com>
@royjacobson royjacobson merged commit 1e61ec8 into main Sep 18, 2023
10 checks passed
@royjacobson royjacobson deleted the server_cntx_mgr branch September 18, 2023 10:52
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.

None yet

3 participants