Skip to content

Conversation

@MichaelTrestman
Copy link
Contributor

Welcome!

Due to GitHub limitations,
please switch to Preview for links to render properly.

Please choose the right template for your pull request:

Comment on lines +226 to +231
subtensor = AsyncSubtensor(network="finney")
await subtensor.initialize()
# Close when done
await subtensor.close()
balance = await subtensor.get_balance(address="5F...")
await subtensor.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

I would highly recommend we steer people toward using the context manager:

async with AsyncSubtensor(network="finney") as subtensor:
    balance = await subtensor.get_balance(address="5F...")

While both solutions work. People are much more prone to forget to await subtensor.close() with the other method.

@thewhaleking
Copy link
Contributor

Is this still relevant?

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.

3 participants