coinbase-advanced-py icon indicating copy to clipboard operation
coinbase-advanced-py copied to clipboard

Store asyncio.Task to Avoid GC

Open Brendan-Blanchard opened this issue 1 year ago • 1 comments

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

Brendan-Blanchard avatar Jul 25 '24 18:07 Brendan-Blanchard

🟡 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

cb-heimdall avatar Jul 25 '24 18:07 cb-heimdall