Skip to content

Close all owned module sessions in PerpetualTradingClient.close()#93

Open
vikions wants to merge 1 commit intox10xchange:starknetfrom
vikions:fix-trading-client-close-all-sessions
Open

Close all owned module sessions in PerpetualTradingClient.close()#93
vikions wants to merge 1 commit intox10xchange:starknetfrom
vikions:fix-trading-client-close-all-sessions

Conversation

@vikions
Copy link
Copy Markdown

@vikions vikions commented Apr 21, 2026

Summary

  • close the missing info, vault, and testnet module sessions in PerpetualTradingClient.close()
  • add a regression test that opens a session through every public sub-client and verifies they are closed after close()

Why

PerpetualTradingClient creates six module clients, but close() only cleaned up three of them. If a caller used client.info, client.vault, or client.testnet, their underlying aiohttp sessions could stay open and leak resources.

Testing

  • python -m py_compile x10/perpetual/trading_client/trading_client.py tests/perpetual/test_trading_client.py
  • pytest tests/perpetual/test_trading_client.py -k close_closes_all_module_sessions
    not runnable in my local environment because hamcrest is not installed

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.

1 participant