coinbase / coinbase-advanced-py

The Advanced API Python SDK is a Python package that makes it easy to interact with the Coinbase Advanced API. The SDK handles authentication, HTTP connections, and provides helpful methods for interacting with the API.
https://docs.cdp.coinbase.com/advanced-trade/docs/welcome/
Apache License 2.0
109 stars 29 forks source link

Store asyncio.Task to Avoid GC #62

Closed Brendan-Blanchard closed 1 month ago

Brendan-Blanchard commented 2 months ago

I was looking through the websocket code recently and noticed that a Task was being created and not stored anywhere. The async docs call this out as a problem since created Tasks can be garbage-collected if they're not referenced by anything, thus stopping them mid-execution.

I haven't seen this occur, but it's an easy fix to store it on the class, and from a quick reading I don't think it should have any side effects.

Link (second badge labeled "Important"): https://docs.python.org/3/library/asyncio-task.html#creating-tasks

cb-heimdall commented 2 months ago

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2