Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Move cleanup logic from __aexit__() to disconnect() #139

Description

@llucax

What's needed?

We need to make it more intuitive for users to be able to add cleanup logic to sub-classes. Right now users need to override __aexit__ which has more complexity than disconnect() (extra arguments), which users usually don't need to care about.

Proposed solution

  • Move cleanup logic from __aexit__() to disconnect() and call disconnect() from __aexit__ (like we call connect() in __aenter__).
  • Document how users should add cleanup code overriding disconnect() (probably add an example with stopping broadcasters, being that one very common use case).

Use cases

  • Stopping and cleaning up broadcasters.

Additional context

The current BaseApiClient implementation calls __aexit__() from disconnect(). I found two public downstream overrides that rely on that call to clean up streams:

I didn't find any disconnect() overrides in the public client implementations I checked. When these clients adopt v0.12.0, they'll need to move the cleanup into disconnect() so it still runs on both explicit disconnect and async with exit.

Activity

  1. added this to the v0.9.0 milestone on May 15, 2025
  2. added
    part:docs
    priority:high
    type:enhancement
    part:code
    on May 15, 2025
  3. self-assigned this
    on May 15, 2025
  4. modified the milestones: v0.9.0, v0.11.0, v0.12.0 on May 28, 2025
  5. added
    scope:breaking-change
    on Nov 30, 2026
  6. updated Effort Low and Priority High on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

part:codepart:docspriority:highscope:breaking-changetype:enhancement

Fields

Priority

High

Effort

Low

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions